Skip to content

Instantly share code, notes, and snippets.

@masaki
Created March 27, 2009 12:41
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save masaki/86675 to your computer and use it in GitHub Desktop.
package MouseX::Log::Log4perl;
use Mouse::Role;
use Log::Log4perl;
our $VERSION = '0.01';
has 'logger' => (
is => 'rw',
isa => 'Log::Log4perl',
lazy => 1,
default => sub { Log::Log4perl->get_logger(shift->meta->name) },
);
sub log {
my ($self, $category) = @_;
return defined $category ? Log::Log4perl->get_logger($category) : $self->logger;
}
sub _log4perl_init { shift; Log::Log4perl->init(@_) }
sub _log4perl_init_once { shift; Log::Log4perl->init_once(@_) }
no Mouse::Role;
1;
=head1 NAME
MouseX::Log::Log4perl
=head1 AUTHOR
NAKAGAWA Masaki E<lt>masaki@cpan.orgE<gt>
=head1 LICENSE
This library is free software, you can redistribute it and/or modify
it under the same terms as Perl itself.
=cut
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment