Don't run the moose controller test if Moose isn't available
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Log.pm
index 24b7931..de89a06 100644 (file)
@@ -2,7 +2,7 @@ package Catalyst::Log;
 
 use strict;
 use base 'Class::Accessor::Fast';
-use Data::Dumper;
+use Data::Dump;
 
 our %LEVELS = ();
 
@@ -62,15 +62,15 @@ sub disable {
 
 sub _dump {
     my $self = shift;
-    local $Data::Dumper::Terse = 1;
-    $self->info( Dumper(@_) );
+    $self->info( Data::Dump::dump(@_) );
 }
 
 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 {
@@ -122,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
 
@@ -212,11 +221,9 @@ over the log output.
 
 L<Catalyst>.
 
-=head1 AUTHOR
+=head1 AUTHORS
 
-Sebastian Riedel, C<sri@cpan.org>
-Marcus Ramberg, C<mramberg@cpan.org>
-Christian Hansen, C<ch@ngmedia.com>
+Catalyst Contributors, see Catalyst.pm
 
 =head1 COPYRIGHT