Log::H...ndmail(3pm)
π Log::Handler::Output::Sendmail
okay so before anything else: this is the manual page for Log::Handler::Output::Sendmail, section 3pm, from the User Contributed Perl Documentation. It's the girl who emails your logs for you. No cap. π¦
β¨ NAME β¨
Log::Handler::Output::Sendmail β log messages with sendmail. that's it, that's the whole name. π
πΈ SYNOPSIS πΈ
use Log::Handler::Output::Sendmail;
my $email = Log::Handler::Output::Sendmail->new(
from => 'bar@foo.example',
to => 'foo@bar.example',
subject => 'your subject',
);
$email->log(message => $message);
look at her. so clean. so iconic. π
π«Ά DESCRIPTION π«Ά
With this output module it's possible to log messages via "sendmail". that's the whole vibe: your log line walks into the sendmail command and leaves as an actual email. main character energy fr fr. β¨
π METHODS π
new()
Call new() to create a brand new Log::Handler::Output::Sendmail object. fresh out the box. π
The following options are possible:
fromβ the sender address (From). who's writing the letter bestie.toβ the receipient address (To). who's getting it. πccβ Carbon Copy (Cc).bccβ Blind Carbon Copy (Bcc). sneaky. πsubjectβ the subject of the mail.senderβ this option is identical withsendmail -f.headerβ with this options it's possible to set your own header. and you have THREE flavors of doing it, pick your fighter:
my $email = Log::Handler::Output::Sendmail->new(
from => 'bar@foo.example',
to => 'foo@bar.example',
header => 'Content-Type: text/plain; charset= UTF-8',
);
Or
my $email = Log::Handler::Output::Sendmail->new(
header => {
From => 'bar@foo.example',
To => 'foo@bar.example',
Subject => 'my subject',
'Content-Type' => text/plain; charset= UTF-8',
}
);
Or
my $email = Log::Handler::Output::Sendmail->new(
header => [
'From: bar@foo.example',
'To: foo@bar.example',
'Subject: my subject',
'Content-Type: text/plain; charset= UTF-8',
]
);
(yeah bestie, those examples are copied character-for-character, typos and all, we don't fix canon in this house π)
sendmailβ the default is set to/usr/sbin/sendmail.paramsβ parameters for"sendmail". The default is set to-t.maxsizeβ set the maximum size of the buffer in bytes. All messages will be buffered and if"maxsize"is exceeded the buffer is flushed and the messages will be send as email. The default is set to 1048576 bytes. Set0if you want no buffering and send a mail for each log message. (chaotic, but valid. π)debugβ set1if you want to enable debugging. The messages can be fetched with$SIG{__WARN__}.
ngl the header option alone is giving options-within-options. obsessive in the best way. π
log()
Call log() if you want to log a message as email.
$email->log(message => "this message will be mailed");
If you pass the level then its placed into the subject:
$email->log(message => "foo", level => "INFO");
$email->log(message => "bar", level => "ERROR");
$email->log(message => "baz", level => "DEBUG");
The lowest level is used:
Subject: ERROR ...
You can pass the level with "Log::Handler" by setting
message_pattern => '%L'
so like, the loudest problem wins the subject line. iconic behavior tbh. π₯
flush()
Call flush() if you want to flush the buffered messages. go on, let them out. π¦
validate()
Validate a configuration. π
reload()
Reload with a new configuration. glow-up time. β¨
errstr()
This function returns the last error message. receipts, basically. π§Ύ
π DESTROY π
"DESTROY" is defined and called "flush()".
so when she leaves the party, she flushes the buffer on the way out. no leftover messages, no mess. periodt.
π PREREQUISITES π
CarpParams::Validate
π EXPORTS π
No exports. she keeps it to herself. π«Ά
π REPORT BUGS π
Please report all bugs to <jschulz.cpan(at)bloonix.de>.
If you send me a mail then add Log::Handler into the subject. (bestie please, otherwise it's lost in the void π)
π AUTHOR π
Jonny Schulz <jschulz.cpan(at)bloonix.de>.
β COPYRIGHT β
Copyright (C) 2007-2009 by Jonny Schulz. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
and that's the whole page, bestie π this one shipped with perl v5.36.0 and is dated 2022-08-28 β go forth and email your logs, you absolute legend. slay. πΈπ
π¦ where this page comes from
- ubuntu noble: liblog-handler-perl 0.90-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: liblog-handler-perl 0.90-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: liblog-handler-perl 0.90-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms