X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst%2FLog.pm;h=7a69d039b3f66bbc94aebb90e38c9c178daddc77;hp=726ef7d4e5a3862a41314e1e11a2ecab85e3cd91;hb=2f3812528068bc1d9f7840067f0c03d36cd47e6d;hpb=5fb12dbb7e69039e0ea22ec4d7cb627206b4508b diff --git a/lib/Catalyst/Log.pm b/lib/Catalyst/Log.pm index 726ef7d..7a69d03 100644 --- a/lib/Catalyst/Log.pm +++ b/lib/Catalyst/Log.pm @@ -12,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]; @@ -19,20 +20,18 @@ 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; - }; + });; } } @@ -99,6 +98,9 @@ sub _send_to_log { print STDERR @_; } +no Moose; +__PACKAGE__->meta->make_immutable(); + 1; __END__ @@ -237,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