10 Nov 2019 06:58:00 UTC
- Distribution: Log-ForPerl
- Module version: 0.02
- Source (raw)
- Browse (raw)
- How to Contribute
- Testers (107 / 0 / 0)
- KwaliteeBus factor: 1
- 60.00% Coverage
- License: unknown
- Activity24 month
- Download (3.61KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest versionLNATION Robert Acock 🤞🌏and 1 contributors
- Elizabeth Mattijsen (email@example.com)
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 Log::Dispatch 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 Carp. 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.
The following caveats may apply to your situation.
Although Log::Dispatch 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 Log::Dispatch::Buffer 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, <firstname.lastname@example.org>.
Please report bugs to <email@example.com>.
Copyright (c) 2004 Elizabeth Mattijsen <firstname.lastname@example.org>. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.