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=89f39e7af8cba80258ae8186f0897494fd419d19;hp=4b3c3c3b0e22b2129f033a6889527ea677863127;hb=f63c03e47ae0278e50d513b90ecbbdfd67d1a021;hpb=b5ecfcf07b8ffe7e9984f0279c8781ce51c6ac6a diff --git a/lib/Catalyst/Log.pm b/lib/Catalyst/Log.pm index 4b3c3c3..89f39e7 100644 --- a/lib/Catalyst/Log.pm +++ b/lib/Catalyst/Log.pm @@ -2,7 +2,7 @@ package Catalyst::Log; use strict; use base 'Class::Accessor::Fast'; -use Data::Dumper; +use Data::Dump; our %LEVELS = (); @@ -62,17 +62,14 @@ sub disable { sub _dump { my $self = shift; - local $Data::Dumper::Terse = 1; - $self->info( Dumper( $_[0] ) ); + $self->info( Data::Dump::dump(@_) ); } sub _log { my $self = shift; my $level = shift; - my $time = localtime(time); my $message = join( "\n", @_ ); - $self->{body} .= - sprintf( "[%s] [catalyst] [%s] %s\n", $time, $level, $message ); + $self->{body} .= sprintf( "[%s] %s\n", $level, $message ); } sub _flush { @@ -81,11 +78,16 @@ sub _flush { $self->abort(undef); } else { - print( STDERR $self->body ); + $self->_send_to_log( $self->body ); } $self->body(undef); } +sub _send_to_log { + my $self = shift; + print STDERR @_; +} + 1; __END__ @@ -112,10 +114,9 @@ See L. =head1 DESCRIPTION -This module provides the default, simple logging functionality for -Catalyst. -If you want something different set C<$c->log> in your application -module, e.g.: +This module provides the default, simple logging functionality for Catalyst. +If you want something different set C<< $c->log >> in your application module, +e.g.: $c->log( MyLogger->new ); @@ -198,6 +199,14 @@ to use Log4Perl or another logger, you should call it like this: $c->log->abort(1) if $c->log->can('abort'); +=head2 _send_to_log + + $log->_send_to_log( @messages ); + +This protected method is what actually sends the log information to STDERR. +You may subclass this module and override this method to get finer control +over the log output. + =head1 SEE ALSO L.