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.23 by root, Sun Aug 21 03:20:52 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 use AnyEvent; 9 use AnyEvent;
9 10
10 AE::log debug => "hit my knee"; 11 AE::log debug => "hit my knee";
11 AE::log warn => "it's a bit too hot"; 12 AE::log warn => "it's a bit too hot";
12 AE::log error => "the flag was false!"; 13 AE::log error => "the flag was false!";
13 AE::log fatal => "the bit toggled! run!"; # never returns 14 AE::log fatal => "the bit toggled! run!"; # never returns
14 15
15 # "complex" use (for speed sensitive code) 16"Complex" uses (for speed sensitive code):
17
16 use AnyEvent::Log; 18 use AnyEvent::Log;
17 19
18 my $tracer = AnyEvent::Log::logger trace => \$my $trace; 20 my $tracer = AnyEvent::Log::logger trace => \$my $trace;
19 21
20 $tracer->("i am here") if $trace; 22 $tracer->("i am here") if $trace;
21 $tracer->(sub { "lots of data: " . Dumper $self }) if $trace; 23 $tracer->(sub { "lots of data: " . Dumper $self }) if $trace;
22 24
23 # configuration 25Configuration (also look at the EXAMPLES section):
24 26
25 # set logging for the current package to errors and higher only 27 # set logging for the current package to errors and higher only
26 AnyEvent::Log::ctx->level ("error"); 28 AnyEvent::Log::ctx->level ("error");
27 29
28 # set logging level to suppress anything below "notice" 30 # set logging level to suppress anything below "notice"
32 # regardless of (most) other settings 34 # regardless of (most) other settings
33 $AnyEvent::Log::COLLECT->attach (new AnyEvent::Log::Ctx 35 $AnyEvent::Log::COLLECT->attach (new AnyEvent::Log::Ctx
34 level => "critical", 36 level => "critical",
35 log_to_syslog => 0, 37 log_to_syslog => 0,
36 ); 38 );
37
38 # see also EXAMPLES, below
39 39
40=head1 DESCRIPTION 40=head1 DESCRIPTION
41 41
42This module implements a relatively simple "logging framework". It doesn't 42This module implements a relatively simple "logging framework". It doesn't
43attempt 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