ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent/lib/AnyEvent/Log.pm
(Generate patch)

Comparing AnyEvent/lib/AnyEvent/Log.pm (file contents):
Revision 1.40 by root, Fri Aug 26 16:18:01 2011 UTC vs.
Revision 1.41 by root, Thu Sep 1 04:07:18 2011 UTC

10 10
11 AE::log debug => "hit my knee"; 11 AE::log debug => "hit my knee";
12 AE::log warn => "it's a bit too hot"; 12 AE::log warn => "it's a bit too hot";
13 AE::log error => "the flag was false!"; 13 AE::log error => "the flag was false!";
14 AE::log fatal => "the bit toggled! run!"; # never returns 14 AE::log fatal => "the bit toggled! run!"; # never returns
15
16 # available log levels in order:
17 # fatal alert critical error warn note info debug trace
15 18
16"Complex" uses (for speed sensitive code): 19"Complex" uses (for speed sensitive code):
17 20
18 use AnyEvent::Log; 21 use AnyEvent::Log;
19 22
84 8 debug 87 8 debug
85 9 trace 88 9 trace
86 89
87As you can see, some logging levels have multiple aliases - the first one 90As you can see, some logging levels have multiple aliases - the first one
88is the "official" name, the second one the "syslog" name (if it differs) 91is the "official" name, the second one the "syslog" name (if it differs)
89and the third one the "perl" name, suggesting that you log C<die> messages 92and the third one the "perl" name, suggesting (only!) that you log C<die>
90at C<error> priority. 93messages at C<error> priority.
91 94
92You can normally only log a single message at highest priority level 95You can normally only log a single message at highest priority level
93(C<1>, C<fatal>), because logging a fatal message will also quit the 96(C<1>, C<fatal>), because logging a fatal message will also quit the
94program - so use it sparingly :) 97program - so use it sparingly :)
95 98
151=item AnyEvent::Log::log $level, $msg[, @args] 154=item AnyEvent::Log::log $level, $msg[, @args]
152 155
153Requests logging of the given C<$msg> with the given log level, and 156Requests logging of the given C<$msg> with the given log level, and
154returns true if the message was logged I<somewhere>. 157returns true if the message was logged I<somewhere>.
155 158
156For C<fatal> log levels, the program will abort. 159For loglevel C<fatal>, the program will abort.
157 160
158If only a C<$msg> is given, it is logged as-is. With extra C<@args>, the 161If only a C<$msg> is given, it is logged as-is. With extra C<@args>, the
159C<$msg> is interpreted as an sprintf format string. 162C<$msg> is interpreted as an sprintf format string.
160 163
161The C<$msg> should not end with C<\n>, but may if that is convenient for 164The C<$msg> should not end with C<\n>, but may if that is convenient for

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines