Log::Report::Dispatcher::Callback - call a code-ref for each log-line
Log::Report::Dispatcher::Callback is a Log::Report::Dispatcher
sub cb($$$) { my ($disp, $options, $reason, $message) = @_; ... } dispatcher Log::Report::Dispatcher::Callback => 'cb' , callback => \&cb; dispatcher CALLBACK => 'cb' # same , callback => \&cb;
This basic file logger accepts a callback, which is called for each message which is to be logged. When you need complex things, you may best make your own extension to Log::Report::Dispatcher, but for simple things this will do.
Extends "DESCRIPTION" in Log::Report::Dispatcher.
Extends "METHODS" in Log::Report::Dispatcher.
Extends "Constructors" in Log::Report::Dispatcher.
Inherited, see "Constructors" in Log::Report::Dispatcher
-Option --Defined in --Default accept Log::Report::Dispatcher depend on mode callback <required> charset Log::Report::Dispatcher <undef> format_reason Log::Report::Dispatcher 'LOWERCASE' locale Log::Report::Dispatcher <system locale> mode Log::Report::Dispatcher 'NORMAL'
Your callback is called with five parameters: this dispatcher object, the options, a reason and a message. The options are the first parameter of Log::Report::report() (read over there). The reason is a capitized string like ERROR. Then, the message (is a Log::Report::Message). Finally the text-domain of the message.
callback
options
reason
ERROR
message
Extends "Accessors" in Log::Report::Dispatcher.
Returns the code reference which will handle each logged message.
Inherited, see "Accessors" in Log::Report::Dispatcher
Extends "Logging" in Log::Report::Dispatcher.
Inherited, see "Logging" in Log::Report::Dispatcher
Extends "DETAILS" in Log::Report::Dispatcher.
This module is part of Log-Report distribution version 1.02, built on March 10, 2014. Website: http://perl.overmeer.net/log-report/
Copyrights 2007-2014 by [Mark Overmeer]. For other contributors see ChangeLog.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://www.perl.com/perl/misc/Artistic.html
To install Log::Report, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Log::Report
CPAN shell
perl -MCPAN -e shell install Log::Report
For more information on module installation, please visit the detailed CPAN module installation guide.