4 use base 'Class::Accessor::Fast';
7 $Data::Dumper::Terse = 1;
11 Catalyst::Log - Catalyst Log Class
16 $log->debug($msg, @args);
18 $log->error($msg, @args);
19 $log->info($msg, @args);
20 $log->warn($msg, @args);
26 This module provides the default, simple logging functionality for Catalyst.
27 If you want something different set C<$c->log> in your application module, e.g.:
29 $c->log( MyLogger->new );
31 Your logging object is expected to provide the interface described here.
38 =item $log->debug($msg, @args)
40 Logs a debugging message.
44 sub debug { _format( 'debug', splice(@_, 1) ) }
46 =item $log->dump($ref)
48 Logs a formatted dump of a variable passed by reference (uses C<Data::Dumper>).
52 sub dump { _format( 'dump', Dumper( $_[1] ) ) }
54 =item $log->error($msg, @args)
56 Logs an error message.
60 sub error { _format( 'error', splice(@_, 1) ) }
62 =item $log->info($msg, @args)
64 Logs an informational message.
68 sub info { _format( 'info', splice(@_, 1) ) }
70 =item $log->warn($msg, @args)
72 Logs a warning message.
76 sub warn { _format( 'warn', splice(@_, 1) ) }
80 printf STDERR '[' . localtime(time) . "] [catalyst] [$_[0]] $_[1]\n", splice(@_, 2);
83 print STDERR '[' . localtime(time) . "] [catalyst] [$_[0]] $_[1]\n";
95 Sebastian Riedel, C<sri@cpan.org>
99 This program is free software, you can redistribute it and/or modify it under
100 the same terms as Perl itself.