1Catalyst::Log(3)      User Contributed Perl Documentation     Catalyst::Log(3)
2
3
4

NAME

6       Catalyst::Log - Catalyst Log Class
7

SYNOPSIS

9           $log = $c->log;
10           $log->debug($message);
11           $log->info($message);
12           $log->warn($message);
13           $log->error($message);
14           $log->fatal($message);
15
16           if ( $log->is_debug ) {
17                # expensive debugging
18           }
19
20       See Catalyst.
21

DESCRIPTION

23       This module provides the default, simple logging functionality for
24       Catalyst.  If you want something different set "$c->log" in your
25       application module, e.g.:
26
27           $c->log( MyLogger->new );
28
29       Your logging object is expected to provide the interface described
30       here.  Good alternatives to consider are Log::Log4Perl and
31       Log::Dispatch.
32
33       If you want to be able to log arbitrary warnings, you can do something
34       along the lines of
35
36           $SIG{__WARN__} = sub { MyApp->log->warn(@_); };
37
38       however this is (a) global, (b) hairy and (c) may have unexpected side
39       effects.  Don't say we didn't warn you.
40

LOG LEVELS

42   debug
43           $log->is_debug;
44           $log->debug($message);
45
46   info
47           $log->is_info;
48           $log->info($message);
49
50   warn
51           $log->is_warn;
52           $log->warn($message);
53
54   error
55           $log->is_error;
56           $log->error($message);
57
58   fatal
59           $log->is_fatal;
60           $log->fatal($message);
61

METHODS

63   new
64       Constructor. Defaults to enable all levels unless levels are provided
65       in arguments.
66
67           $log = Catalyst::Log->new;
68           $log = Catalyst::Log->new( 'warn', 'error' );
69
70   level
71       Contains a bitmask of the currently set log levels.
72
73   levels
74       Set log levels
75
76           $log->levels( 'warn', 'error', 'fatal' );
77
78   enable
79       Enable log levels
80
81           $log->enable( 'warn', 'error' );
82
83   disable
84       Disable log levels
85
86           $log->disable( 'warn', 'error' );
87
88   is_debug
89   is_error
90   is_fatal
91   is_info
92   is_warn
93       Is the log level active?
94
95   abort
96       Should Catalyst emit logs for this request? Will be reset at the end of
97       each request.
98
99       *NOTE* This method is not compatible with other log apis, so if you
100       plan to use Log4Perl or another logger, you should call it like this:
101
102           $c->log->abort(1) if $c->log->can('abort');
103
104   _send_to_log
105        $log->_send_to_log( @messages );
106
107       This protected method is what actually sends the log information to
108       STDERR.  You may subclass this module and override this method to get
109       finer control over the log output.
110
111   meta

SEE ALSO

113       Catalyst.
114

AUTHORS

116       Catalyst Contributors, see Catalyst.pm
117
119       This library is free software. You can redistribute it and/or modify it
120       under the same terms as Perl itself.
121
122
123
124perl v5.12.1                      2009-11-22                  Catalyst::Log(3)
Impressum