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.49 by root, Thu Mar 22 01:03:57 2012 UTC vs.
Revision 1.50 by root, Thu Mar 22 01:24:19 2012 UTC

894 894
895Replaces the formatting callback on the context (C<undef> restores the 895Replaces the formatting callback on the context (C<undef> restores the
896default formatter). 896default formatter).
897 897
898The callback is passed the (possibly fractional) timestamp, the original 898The callback is passed the (possibly fractional) timestamp, the original
899logging context, the (numeric) logging level and the raw message string 899logging context (object, not title), the (numeric) logging level and
900and needs to return a formatted log message. In most cases this will be a 900the raw message string and needs to return a formatted log message. In
901string, but it could just as well be an array reference that just stores 901most cases this will be a string, but it could just as well be an array
902the values. 902reference that just stores the values.
903 903
904If, for some reason, you want to use C<caller> to find out more about the 904If, for some reason, you want to use C<caller> to find out more about the
905logger then you should walk up the call stack until you are no longer 905logger then you should walk up the call stack until you are no longer
906inside the C<AnyEvent::Log> package. 906inside the C<AnyEvent::Log> package.
907 907
913 913
914 "<$lvl>$msg\n" 914 "<$lvl>$msg\n"
915 }); 915 });
916 916
917Example: return an array reference with just the log values, and use 917Example: return an array reference with just the log values, and use
918C<PApp::SQL::sql_exec> to store the emssage in a database. 918C<PApp::SQL::sql_exec> to store the message in a database.
919 919
920 $ctx->fmt_cb (sub { \@_ }); 920 $ctx->fmt_cb (sub { \@_ });
921 $ctx->log_cb (sub { 921 $ctx->log_cb (sub {
922 my ($msg) = @_; 922 my ($msg) = @_;
923 923

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines