Log::Dispatch::Email::MailSender - Subclass of Log::Dispatch::Email that uses the Mail::Sender module
use Log::Dispatch::Email::MailSender; my $email = Log::Dispatch::Email::MailSender->new ( name => 'email', min_level => 'emerg', to => [ qw( foo@bar.com bar@baz.org ) ], subject => 'Oh no!!!!!!!!!!!', smtp => 'mail.foo.bar' ); $email->log( message => 'Something bad is happening', level => 'emerg' );
This is a subclass of Log::Dispatch::Email that implements the send_email method using the Mail::Sender module.
This method takes a hash of parameters. The following options are valid:
A string containing an email address. This is optional and may not work with all mail sending methods.
NOTE: The Mail::Sender module requires an address be passed to it to set this in the mail it sends. We pass in 'LogDispatch@foo.bar' as the default.
This parameter may be a single subroutine reference or an array reference of subroutine references. These callbacks will be called in the order they are given and passed a hash containing the following keys:
( message => $log_message, level => $log_level )
The callbacks are expected to modify the message and then return a
single scalar containing that modified message. These callbacks will
be called when either the log
or log_to
methods are called and
will only be applied to a given message once.
Joseph Annino. <jannino@jannino.com>
Dave Rolsky, <autarch@urth.org>