X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FLog.pm;h=7a69d039b3f66bbc94aebb90e38c9c178daddc77;hb=3295c7dbc672a0d1c03f657a2a37f12f322bbece;hp=a45fb59643c5767a6f69bdcacfce85664aa39c35;hpb=6f1f968a6bc42bf4a4b50a1ee22d3aaecd801876;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Log.pm b/lib/Catalyst/Log.pm index a45fb59..7a69d03 100644 --- a/lib/Catalyst/Log.pm +++ b/lib/Catalyst/Log.pm @@ -1,7 +1,5 @@ package Catalyst::Log; -use MRO::Compat; -use mro 'c3'; use Moose; use Data::Dump; @@ -14,6 +12,7 @@ has abort => (is => 'rw'); { my @levels = qw[ debug info warn error fatal ]; + my $meta = __PACKAGE__->meta; for ( my $i = 0 ; $i < @levels ; $i++ ) { my $name = $levels[$i]; @@ -21,29 +20,28 @@ has abort => (is => 'rw'); $LEVELS{$name} = $level; - no strict 'refs'; - - *{$name} = sub { + $meta->add_method($name, sub { my $self = shift; if ( $self->level & $level ) { $self->_log( $name, @_ ); } - }; + }); - *{"is_$name"} = sub { + $meta->add_method("is_$name", sub { my $self = shift; return $self->level & $level; - }; + });; } } -sub new { +around new => sub { + my $orig = shift; my $class = shift; - my $self = $class->next::method; + my $self = $class->$orig; $self->levels( scalar(@_) ? @_ : keys %LEVELS ); return $self; -} +}; sub levels { my ( $self, @levels ) = @_; @@ -241,11 +239,9 @@ over the log output. L. -=head1 AUTHOR +=head1 AUTHORS -Sebastian Riedel, C -Marcus Ramberg, C -Christian Hansen, C +Catalyst Contributors, see Catalyst.pm =head1 COPYRIGHT