… | |
… | |
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 | |
87 | As you can see, some logging levels have multiple aliases - the first one |
90 | As you can see, some logging levels have multiple aliases - the first one |
88 | is the "official" name, the second one the "syslog" name (if it differs) |
91 | is the "official" name, the second one the "syslog" name (if it differs) |
89 | and the third one the "perl" name, suggesting that you log C<die> messages |
92 | and the third one the "perl" name, suggesting (only!) that you log C<die> |
90 | at C<error> priority. |
93 | messages at C<error> priority. |
91 | |
94 | |
92 | You can normally only log a single message at highest priority level |
95 | You 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 |
94 | program - so use it sparingly :) |
97 | program - so use it sparingly :) |
95 | |
98 | |
… | |
… | |
151 | =item AnyEvent::Log::log $level, $msg[, @args] |
154 | =item AnyEvent::Log::log $level, $msg[, @args] |
152 | |
155 | |
153 | Requests logging of the given C<$msg> with the given log level, and |
156 | Requests logging of the given C<$msg> with the given log level, and |
154 | returns true if the message was logged I<somewhere>. |
157 | returns true if the message was logged I<somewhere>. |
155 | |
158 | |
156 | For C<fatal> log levels, the program will abort. |
159 | For loglevel C<fatal>, the program will abort. |
157 | |
160 | |
158 | If only a C<$msg> is given, it is logged as-is. With extra C<@args>, the |
161 | If only a C<$msg> is given, it is logged as-is. With extra C<@args>, the |
159 | C<$msg> is interpreted as an sprintf format string. |
162 | C<$msg> is interpreted as an sprintf format string. |
160 | |
163 | |
161 | The C<$msg> should not end with C<\n>, but may if that is convenient for |
164 | The C<$msg> should not end with C<\n>, but may if that is convenient for |