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.22 by root, Sun Aug 21 02:19:30 2011 UTC vs.
Revision 1.23 by root, Sun Aug 21 03:20:52 2011 UTC

8 use AnyEvent; 8 use AnyEvent;
9 9
10 AE::log debug => "hit my knee"; 10 AE::log debug => "hit my knee";
11 AE::log warn => "it's a bit too hot"; 11 AE::log warn => "it's a bit too hot";
12 AE::log error => "the flag was false!"; 12 AE::log error => "the flag was false!";
13 AE::log fatal => "the bit toggled! run!"; 13 AE::log fatal => "the bit toggled! run!"; # never returns
14 14
15 # "complex" use 15 # "complex" use (for speed sensitive code)
16 use AnyEvent::Log; 16 use AnyEvent::Log;
17 17
18 my $tracer = AnyEvent::Log::logger trace => \$my $trace; 18 my $tracer = AnyEvent::Log::logger trace => \$my $trace;
19 19
20 $tracer->("i am here") if $trace; 20 $tracer->("i am here") if $trace;
23 # configuration 23 # configuration
24 24
25 # set logging for the current package to errors and higher only 25 # set logging for the current package to errors and higher only
26 AnyEvent::Log::ctx->level ("error"); 26 AnyEvent::Log::ctx->level ("error");
27 27
28 # set logging globally to anything below debug 28 # set logging level to suppress anything below "notice"
29 $AnyEvent::Log::FILTER->level ("notice"); 29 $AnyEvent::Log::FILTER->level ("notice");
30
31 # send all critical and higher priority messages to syslog,
32 # regardless of (most) other settings
33 $AnyEvent::Log::COLLECT->attach (new AnyEvent::Log::Ctx
34 level => "critical",
35 log_to_syslog => 0,
36 );
30 37
31 # see also EXAMPLES, below 38 # see also EXAMPLES, below
32 39
33=head1 DESCRIPTION 40=head1 DESCRIPTION
34 41

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines