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=3f67952b36726bb8b34b5578948b3df5377e37e3;hp=c1ba85a0eebf0e3513f30eaaac236487a9020b1d;hb=0fc2d522eec43202c21e9f0062e43f10db4d9008;hpb=e5ecd5bc38bac3e2fcfaf643ea2a4c6ab46d7e57 diff --git a/lib/Catalyst/Log.pm b/lib/Catalyst/Log.pm index c1ba85a..3f67952 100644 --- a/lib/Catalyst/Log.pm +++ b/lib/Catalyst/Log.pm @@ -1,12 +1,13 @@ package Catalyst::Log; +use Class::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 +37,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 +99,9 @@ sub _send_to_log { print STDERR @_; } +no Moose; +__PACKAGE__->meta->make_immutable(); + 1; __END__ @@ -215,8 +218,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: