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.45 by root, Sun Oct 2 00:42:04 2011 UTC vs.
Revision 1.46 by root, Sun Oct 2 01:22:01 2011 UTC

191 191
192Last not least, C<$msg> might be a code reference, in which case it is 192Last not least, C<$msg> might be a code reference, in which case it is
193supposed to return the message. It will be called only then the message 193supposed to return the message. It will be called only then the message
194actually gets logged, which is useful if it is costly to create the 194actually gets logged, which is useful if it is costly to create the
195message in the first place. 195message in the first place.
196
197This function takes care of saving and restoring C<$!> and C<$@>, so you
198don't have to.
196 199
197Whether the given message will be logged depends on the maximum log level 200Whether the given message will be logged depends on the maximum log level
198and the caller's package. The return value can be used to ensure that 201and the caller's package. The return value can be used to ensure that
199messages or not "lost" - for example, when L<AnyEvent::Debug> detects a 202messages or not "lost" - for example, when L<AnyEvent::Debug> detects a
200runtime error it tries to log it at C<die> level, but if that message is 203runtime error it tries to log it at C<die> level, but if that message is
300 } 303 }
301 304
302 # log if log cb 305 # log if log cb
303 if ($ctx->[3]) { 306 if ($ctx->[3]) {
304 # logging target found 307 # logging target found
308
309 local ($!, $@);
305 310
306 # now get raw message, unless we have it already 311 # now get raw message, unless we have it already
307 unless ($now) { 312 unless ($now) {
308 $format = $format->() if ref $format; 313 $format = $format->() if ref $format;
309 $format = sprintf $format, @args if @args; 314 $format = sprintf $format, @args if @args;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines