Commit | Line | Data |
fc7ec1d9 |
1 | package Catalyst::Log; |
2 | |
3 | use strict; |
4 | use base 'Class::Accessor::Fast'; |
5 | |
6 | =head1 NAME |
7 | |
8 | Catalyst::Log - Catalyst Log Class |
9 | |
10 | =head1 SYNOPSIS |
11 | |
12 | See L<Catalyst>. |
13 | |
14 | =head1 DESCRIPTION |
15 | |
16 | Simple logging functionality for Catalyst. |
17 | |
18 | =head2 METHODS |
19 | |
20 | =head3 debug |
21 | |
22 | Log debug informations. |
23 | |
24 | =cut |
25 | |
26 | sub debug { _format( 'debug', $_[1] ) } |
27 | |
28 | =head3 error |
29 | |
30 | Log error informations. |
31 | |
32 | =cut |
33 | |
34 | sub error { _format( 'error', $_[1] ) } |
35 | |
36 | =head3 info |
37 | |
38 | Log informations. |
39 | |
40 | =cut |
41 | |
42 | sub info { _format( 'info', $_[1] ) } |
43 | |
44 | =head3 warn |
45 | |
46 | Log warnings. |
47 | |
48 | =cut |
49 | |
50 | sub warn { _format( 'warn', $_[1] ) } |
51 | |
52 | sub _format { |
53 | print STDERR '[' . localtime(time) . "] [catalyst] [$_[0]] $_[1]\n"; |
54 | } |
55 | |
56 | =head1 SEE ALSO |
57 | |
58 | L<Catalyst>. |
59 | |
60 | =head1 AUTHOR |
61 | |
62 | Sebastian Riedel, C<sri@cpan.org> |
63 | |
64 | =head1 COPYRIGHT |
65 | |
66 | This program is free software, you can redistribute it and/or modify it under |
67 | the same terms as Perl itself. |
68 | |
69 | =cut |
70 | |
71 | 1; |