Log::A...eHandle(3pm)
π Log::Any::Adapter::FileHandle π
okay so bestie, we're in the User Contributed Perl Documentation corner of the manual pages, and this lil icon is called Log::Any::Adapter::FileHandle. The manual page header just labels it Log::A...eHandle(3pm) because terminals are dramatic and truncate things, but you and me? We know her full name. π«Ά
β¨ NAME β¨
Log::Any::Adapter::FileHandle β it's a basic Log::Any::Adapter whose whole entire job is forwarding your messages to a filehandle. that's it. that's the gig. π
πΈ VERSION πΈ
version 0.010 β yes she's on 0.010, she's vintage, she's established, respect her. π
π¦ SYNOPSIS π¦
the vibe, in code form:
use Log::Any qw($log);
use Log::Any::Adapter;
# Send all logs to Log::Any::Adapter::FileHandle
Log::Any::Adapter->set('FileHandle');
$log->info("Hello world");
literally three lines of setup and your logs are out the door. no cap. π₯
π DESCRIPTION π
so this module is a basic adapter that will simply forward log messages to a filehandle, or honestly to any object that supports a print method β think IO::String, IO::Socket::INET, Plack's $env->{psgi.errors} object, that whole squad. it's giving flexible. it's giving "bring your own sink". β¨
the author made it so their scripts running under damontools or runit could output messages to locally defined logs. and here's the tea: it does not timestamp messages β that responsibility is delegated to the external log capture mechanism. so don't come for her about timestamps, that was never her job. π
you can override the default configuration by passing extra arguments to the Log::Any set_adapter method:
π the options π
fhβ pass in your IO::Handle-like object right here bestie. if this isn't specified, it will default to openingSTDERR. and if the object supports anautoflushmethod, autoflush will be enabled β unlessno_autoflushis set. read that again, it's a little conditional and it matters. πno_autoflushβ disables automatically turning on autoflush on thefhobject. that's the whole thing. short queen. πformatβ asprintfstring that controls the formatting of the message. it is supplied 2 arguments: the log level as supplied byLog::Any(usually all-lowercase), and the message to be logged. the default is:
"[%s] %s\n"
β οΈ heads up: this value should contain the log record terminator, such as a newline. don't skip the newline and then act surprised, i'm begging. π
escapeβ one of'none'(the default),'newline', or'nonascii'. it controls how messages are pre-filtered before passing them to a filehandle. this is handy if you want to smoosh messages into a single line (for easier filtering + processing), or if you want to filter non ascii characters for safe terminal printing. two very different little gremlin use cases, both valid. π§
π COPYRIGHT AND LICENSE π
Copyright 2014 by Jason Jay Rodrigues <jasonjayr+oss@gmail.com> π
Log::Any::Adapter::FileHandle is provided "as is" and without any express or implied warranties, including, without limitation, the implied warranties of merchantibility and fitness for a particular purpose. like, she's doing her best, okay? π
this program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. slay. π
and that's the whole page bestie β this was perl v5.36.0, dated 2022-11-19, filed under Log::A...eHandle(3pm) in the User Contributed Perl Documentation. go forth and forward your logs, you absolute main character. ππ«Ά
π¦ where this page comes from
- debian bookworm: liblog-any-adapter-filehandle-perl 0.010-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: liblog-any-adapter-filehandle-perl 0.010-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: liblog-any-adapter-filehandle-perl 0.010-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: liblog-any-adapter-filehandle-perl 0.010-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: liblog-any-adapter-filehandle-perl 0.010-3 Β· 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