… | |
… | |
49 | will be logged, unless you set C<PERL_ANYEVENT_VERBOSE> to a higher number |
49 | will be logged, unless you set C<PERL_ANYEVENT_VERBOSE> to a higher number |
50 | before starting your program, or change the logging level at runtime with |
50 | before starting your program, or change the logging level at runtime with |
51 | something like: |
51 | something like: |
52 | |
52 | |
53 | use AnyEvent::Log; |
53 | use AnyEvent::Log; |
54 | AnyEvent::Log::FILTER->level ("info"); |
54 | $AnyEvent::Log::FILTER->level ("info"); |
55 | |
55 | |
56 | The design goal behind this module was to keep it simple (and small), |
56 | The design goal behind this module was to keep it simple (and small), |
57 | but make it powerful enough to be potentially useful for any module, and |
57 | but make it powerful enough to be potentially useful for any module, and |
58 | extensive enough for the most common tasks, such as logging to multiple |
58 | extensive enough for the most common tasks, such as logging to multiple |
59 | targets, or being able to log into a database. |
59 | targets, or being able to log into a database. |
60 | |
60 | |
61 | The amount of documentation might indicate otherwise, but the module is |
61 | The amount of documentation might indicate otherwise, but the runtime part |
62 | still just below 300 lines of code. |
62 | of the module is still just below 300 lines of code. |
63 | |
63 | |
64 | =head1 LOGGING LEVELS |
64 | =head1 LOGGING LEVELS |
65 | |
65 | |
66 | Logging levels in this module range from C<1> (highest priority) to C<9> |
66 | Logging levels in this module range from C<1> (highest priority) to C<9> |
67 | (lowest priority). Note that the lowest numerical value is the highest |
67 | (lowest priority). Note that the lowest numerical value is the highest |
… | |
… | |
513 | } |
513 | } |
514 | |
514 | |
515 | @$_ = ($_->[0], (1 << 10) - 1 - 1) |
515 | @$_ = ($_->[0], (1 << 10) - 1 - 1) |
516 | for $LOG, $FILTER, $COLLECT; |
516 | for $LOG, $FILTER, $COLLECT; |
517 | |
517 | |
518 | $LOG->slaves; |
518 | #$LOG->slaves; |
519 | $LOG->title ('$AnyEvent::Log::LOG'); |
519 | $LOG->title ('$AnyEvent::Log::LOG'); |
520 | $LOG->log_to_warn; |
520 | $LOG->log_to_warn; |
521 | |
521 | |
522 | $FILTER->slaves ($LOG); |
522 | $FILTER->slaves ($LOG); |
523 | $FILTER->title ('$AnyEvent::Log::FILTER'); |
523 | $FILTER->title ('$AnyEvent::Log::FILTER'); |
… | |
… | |
1088 | My::Module=+,file=/tmp/mymodulelog |
1088 | My::Module=+,file=/tmp/mymodulelog |
1089 | |
1089 | |
1090 | =back |
1090 | =back |
1091 | |
1091 | |
1092 | Any character can be escaped by prefixing it with a C<\> (backslash), as |
1092 | Any character can be escaped by prefixing it with a C<\> (backslash), as |
1093 | usual, so to log to a file containing a comma, colon, backslash and space in the |
1093 | usual, so to log to a file containing a comma, colon, backslash and some |
1094 | filename, you would do this: |
1094 | spaces in the filename, you would do this: |
1095 | |
1095 | |
1096 | PERL_ANYEVENT_LOG='log=file=/some\ \:file\ with\,\ \\-escapes' |
1096 | PERL_ANYEVENT_LOG='log=file=/some\ \:file\ with\,\ \\-escapes' |
1097 | |
1097 | |
1098 | Since whitespace (which includes newlines) is allowed, it is fine to |
1098 | Since whitespace (which includes newlines) is allowed, it is fine to |
1099 | specify multiple lines in C<PERL_ANYEVENT_LOG>, e.g.: |
1099 | specify multiple lines in C<PERL_ANYEVENT_LOG>, e.g.: |