X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FLog.pm;h=de89a0605c7097d3fd1d023ea27c159acc2f3ad9;hb=e73e3bad5248d5d16e6b32024ca341d1208e7bcb;hp=89f39e7af8cba80258ae8186f0897494fd419d19;hpb=f63c03e47ae0278e50d513b90ecbbdfd67d1a021;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Log.pm b/lib/Catalyst/Log.pm index 89f39e7..de89a06 100644 --- a/lib/Catalyst/Log.pm +++ b/lib/Catalyst/Log.pm @@ -69,7 +69,8 @@ sub _log { my $self = shift; my $level = shift; my $message = join( "\n", @_ ); - $self->{body} .= sprintf( "[%s] %s\n", $level, $message ); + $message .= "\n" unless $message =~ /\n$/; + $self->{body} .= sprintf( "[%s] %s", $level, $message ); } sub _flush { @@ -121,6 +122,15 @@ e.g.: $c->log( MyLogger->new ); Your logging object is expected to provide the interface described here. +Good alternatives to consider are Log::Log4Perl and Log::Dispatch. + +If you want to be able to log arbitrary warnings, you can do something along +the lines of + + $SIG{__WARN__} = sub { MyApp->log->warn(@_); }; + +however this is (a) global, (b) hairy and (c) may have unexpected side effects. +Don't say we didn't warn you. =head1 LOG LEVELS @@ -211,11 +221,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