|
Log::ForPerl - Log standard Perl warnings and errors |
Log::ForPerl - Log standard Perl warnings and errors
use Log::ForPerl; # install to be used later
my $dispatcher = Log::Dispatch->new; $dispatcher->add( Log::ForPerl->new( name => 'foo', min_level => 'info', ) );
use Log::ForPerl $dispatcher; # activate later
Log::ForPerl->dispatcher( $dispatcher ); # same
warn "This is a warning"; # now also dispatched die "Sorry it didn't work out"; # now also dispatched
no Log::ForPerl; # deactivate later
Log::ForPerl->dispatcher( undef ); # same
warn "This is a warning"; # no longer dispatched die "Sorry it didn't work out"; # no longer dispatched
The ``Log::ForPerl'' module offers a logging alternative for standard Perl core functions. This allows you to use the features of the Log::Dispatch manpage without having to make extensive changes to your source code.
When loaded, it installs a __WARN__ and __DIE__ handler. It also takes over the messaging functions of the Carp manpage. Without being further activated, the standard Perl logging functions continue to be done.
Then, when necessary, you can activate actual logging through Log::Dispatch by installing a log dispatcher. From then on, any warn, die, carp, croak, cluck or confess will be logged using the Log::Dispatch logging dispatcher. Logging can be disabled and enabled at any time for critical sections of code.
(none)
The following caveats may apply to your situation.
Although the Log::Dispatch manpage is not listed as a prerequisite, the real use of this module only comes into view when that module is installed. Please note that for testing this module, you will need the the Log::Dispatch::Buffer manpage module to also be available.
In the current implementation of Perl, a __DIE__ handler is also called inside an eval. Whereas a normal
Elizabeth Mattijsen, <liz@dijkmat.nl>.
Please report bugs to <perlbugs@dijkmat.nl>.
Copyright (c) 2004 Elizabeth Mattijsen <liz@dijkmat.nl>. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
|
Log::ForPerl - Log standard Perl warnings and errors |