Courie...OHandle(3pm)
π Courier::Filter::Logger::IOHandle π
okay bestie so this is the User Contributed Perl Documentation page for Courier::Filter::Logger::IOHandle (it's section 3pm, the Perl module girlies know β¨). It's genuinely one of the easiest little modules to love so let's get into it π«Ά
πΈ NAME πΈ
Courier::Filter::Logger::IOHandle β the I/O handle logger for the Courier::Filter framework. that's it. that's the whole job. she logs to a handle. iconic behavior π
β¨ SYNOPSIS β¨
use Courier::Filter::Logger::IOHandle;
my $logger = Courier::Filter::Logger::IOHandle->new(
handle => $handle
);
# For use in an individual filter module:
my $module = Courier::Filter::Module::My->new(
...
logger => $logger,
...
);
# For use as a global Courier::Filter logger object:
my $filter = Courier::Filter->new(
...
logger => $logger,
...
);
see how chill that is?? make the logger, hand it a handle, then either slot it into one filter module or make it the global logger for the whole Courier::Filter object. main character energy for a logger fr fr π
π¦ DESCRIPTION π¦
So this class is an I/O handle logger class, and you use it with Courier::Filter and with its filter modules. That's the vibe. She writes your log messages out to a handle, done π
π Constructor π
Here's the one constructor she comes with, bestie:
new(%options): returns Courier::Filter::Logger::IOHandle
Makes you a brand new logger that logs messages as lines to an I/O handle. no cap π§
%options is a list of key/value pairs, and you can pass any of these:
handleβ Required. This is the I/O handle, or theIO::Handleobject, that log messages get written to. You gotta give her one, she will not spawn her own, periodt πtimestampβ A boolean value. It controls whether every single log message line gets prefixed with a timestamp β and that timestamp is in local time, in ISO format. Defaults tofalse, so if you want stamps you gotta ask for them π
π Instance methods π
Two methods, both of them little divas that throw Perl exceptions. Noted. Respectfully. π
log_error($text): throws Perl exceptions
Logs the error message you hand it as $text. And heads up: $text is a string that may contain newlines β she handles that, she just checks each line. If you set the "timestamp" option back in the constructor, every line gets prefixed with a timestamp. β¨
log_rejected_message($message, $reason): throws Perl exceptions
Logs the Courier::Message given as $message as having been rejected, and the reason why is $reason β which, same deal, is a string that may contain newlines. Bye bye message, hello log entry π
π SEE ALSO π
Courier::Filter::LoggerCourier::Filter::Overview
And for AVAILABILITY, SUPPORT, and LICENSE info, bestie, you go look at Courier::Filter::Overview. all the fine print lives there π«Ά
π AUTHOR π
Julian Mehnle <julian@mehnle.net> β thank you for your service king π«‘
not me getting emotional over a logger module π she's small, she's focused, she writes lines to a handle. we stan.
slay, that's the whole page. This lil' thing shipped as part of perl v5.34.0, dated 2022-10-21. mwah ππ β¨
π¦ where this page comes from
- debian bookworm: courier-filter-perl 0.200+ds-6 Β· Artistic-1.0-Perl OR GPL-2.0-or-later
- debian trixie: courier-filter-perl 0.200+ds-6 Β· Artistic-1.0-Perl OR GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms