Created
March 27, 2009 12:41
-
-
Save masaki/86675 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>[email protected]<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