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=a45fb59643c5767a6f69bdcacfce85664aa39c35;hp=c1ba85a0eebf0e3513f30eaaac236487a9020b1d;hb=6f1f968a6bc42bf4a4b50a1ee22d3aaecd801876;hpb=e5ecd5bc38bac3e2fcfaf643ea2a4c6ab46d7e57 diff --git a/lib/Catalyst/Log.pm b/lib/Catalyst/Log.pm index c1ba85a..a45fb59 100644 --- a/lib/Catalyst/Log.pm +++ b/lib/Catalyst/Log.pm @@ -1,12 +1,14 @@ package Catalyst::Log; +use MRO::Compat; +use mro 'c3'; use Moose; use Data::Dump; our %LEVELS = (); has level => (is => 'rw'); -has _body => (is => 'rw'); +has _body => (is => 'rw'); has abort => (is => 'rw'); { @@ -36,13 +38,12 @@ has abort => (is => 'rw'); } } -around new => sub { - my $orig = shift; +sub new { my $class = shift; - my $self = $class->$orig; + my $self = $class->next::method; $self->levels( scalar(@_) ? @_ : keys %LEVELS ); return $self; -}; +} sub levels { my ( $self, @levels ) = @_; @@ -99,6 +100,9 @@ sub _send_to_log { print STDERR @_; } +no Moose; +__PACKAGE__->meta->make_immutable(); + 1; __END__ @@ -215,8 +219,8 @@ Is the log level active? =head2 abort -Should Catalyst emit logs for this request? Will be reset at the end of -each request. +Should Catalyst emit logs for this request? Will be reset at the end of +each request. *NOTE* This method is not compatible with other log apis, so if you plan to use Log4Perl or another logger, you should call it like this: