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.24 by root, Sun Aug 21 03:24:59 2011 UTC vs.
Revision 1.25 by root, Sun Aug 21 03:25:47 2011 UTC

2 2
3AnyEvent::Log - simple logging "framework" 3AnyEvent::Log - simple logging "framework"
4 4
5=head1 SYNOPSIS 5=head1 SYNOPSIS
6 6
7 # simple use: 7Simple uses:
8 8
9 use AnyEvent; 9 use AnyEvent;
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 15
16 # "complex" use (for speed sensitive code): 16"Complex" uses (for speed sensitive code):
17 17
18 use AnyEvent::Log; 18 use AnyEvent::Log;
19 19
20 my $tracer = AnyEvent::Log::logger trace => \$my $trace; 20 my $tracer = AnyEvent::Log::logger trace => \$my $trace;
21 21
22 $tracer->("i am here") if $trace; 22 $tracer->("i am here") if $trace;
23 $tracer->(sub { "lots of data: " . Dumper $self }) if $trace; 23 $tracer->(sub { "lots of data: " . Dumper $self }) if $trace;
24 24
25 # configuration: 25Configuration (also look at the EXAMPLES section):
26 26
27 # set logging for the current package to errors and higher only 27 # set logging for the current package to errors and higher only
28 AnyEvent::Log::ctx->level ("error"); 28 AnyEvent::Log::ctx->level ("error");
29 29
30 # set logging level to suppress anything below "notice" 30 # set logging level to suppress anything below "notice"
34 # regardless of (most) other settings 34 # regardless of (most) other settings
35 $AnyEvent::Log::COLLECT->attach (new AnyEvent::Log::Ctx 35 $AnyEvent::Log::COLLECT->attach (new AnyEvent::Log::Ctx
36 level => "critical", 36 level => "critical",
37 log_to_syslog => 0, 37 log_to_syslog => 0,
38 ); 38 );
39
40 # see also EXAMPLES, below
41 39
42=head1 DESCRIPTION 40=head1 DESCRIPTION
43 41
44This module implements a relatively simple "logging framework". It doesn't 42This module implements a relatively simple "logging framework". It doesn't
45attempt to be "the" logging solution or even "a" logging solution for 43attempt to be "the" logging solution or even "a" logging solution for

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines