|
NAMELog::Report::Dispatcher::Callback - call a code-ref for each log-line INHERITANCELog::Report::Dispatcher::Callback is a Log::Report::Dispatcher SYNOPSIS sub cb($$$)
{ my ($disp, $options, $reason, $message) = @_;
...
}
dispatcher Log::Report::Dispatcher::Callback => 'cb'
, callback => \&cb;
dispatcher CALLBACK => 'cb' # same
, callback => \&cb;
DESCRIPTIONThis 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. . Example sub send_mail($$$)
{ my ($disp, $options, $reason, $message) = @_;
my $msg = Mail::Send->new(Subject => $reason
, To => 'admin@localhost');
my $fh = $msg->open('sendmail');
print $fh $disp->translate($reason, $message);
close $fh;
}
dispatcher CALLBACK => 'mail', callback => \&send_mail;
METHODSExtends "METHODS" in Log::Report::Dispatcher. ConstructorsExtends "Constructors" in Log::Report::Dispatcher.
AccessorsExtends "Accessors" in Log::Report::Dispatcher.
LoggingExtends "Logging" in Log::Report::Dispatcher.
DETAILSExtends "DETAILS" in Log::Report::Dispatcher. SEE ALSOThis module is part of Log-Report distribution version 1.40, built on April 18, 2025. Website: http://perl.overmeer.net/CPAN/ LICENSECopyrights 2007-2025 by [Mark Overmeer <markov@cpan.org>]. 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://dev.perl.org/licenses/
|