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