Agent:...efault(3pm)

πŸ“¦
version 1.005 Β· 5 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– Agent:...efault(3pm) β€” Log::Agent::Driver::Default πŸ’–

okay bestie, so this page is literally called Agent:...efault(3pm) and no, the title isn't having a stroke β€” it's just the truncation vibe. What you're actually looking at is Log::Agent::Driver::Default, and it's a Perl thing, so buckle up πŸŽ€


✨ NAME ✨

Log::Agent::Driver::Default β€” the default logging driver for Log::Agent. she's the baseline, the blueprint, the moment ✨


🌸 SYNOPSIS 🌸

Two ways to do this, and honestly both are giving:

Implicit use β€” you just let her show up uninvited (in the best way):

# Implicit use
use Log::Agent;
logconfig(-prefix => "prefix");   # optional

Explicit use β€” you're a control freak and I respect it πŸ’…:

# Explicit use
use Log::Agent;
require Log::Agent::Driver::Default;

my $driver = Log::Agent::Driver::Default->make("prefix");
logconfig(-driver => $driver);

πŸ‘‘ DESCRIPTION πŸ‘‘

So the default logging driver takes all your logxxx() operations and remaps them to their default Perl counterpart. Like, it's a translator but the translation is "just use Perl, babe."

For instance: logerr() will issue a warn(), and logwarn() will call warn() with a clear "WARNING: " emphasis β€” because otherwise how would you ever tell the two calls apart?? 😭 the emphasis is the whole point.

The only routine that matters here is the creation routine, so let's give her the spotlight:

  • make($prefix) β€” creates a Log::Agent::Driver::Default driver whose prefix string will be $prefix. And when no prefix is configured at all? The first letter of each logged string gets uppercased. that's it. that's the whole personality πŸ¦‹

🌈 CHANNELS 🌈

The "error", "output" and "debug" channels all go to STDERR.

all three of them. same place. STDERR gets everything, she's carrying the whole team fr fr πŸ’€


🚨 BUGS 🚨

okay this one's a little spicy, listen up:

If logdie() is used within an eval(), the string you will get in $@ will be prefixed.

and no, it's not really a bug, bestie β€” it's simply that wrapping code into eval() and parsing $@ is poor's man exception handling, and it shows its limit right here πŸ‘€

Because here's the thing: the programmer using logdie() cannot foresee which driver will be used, so the returned string cannot be determined precisely. You literally can't know what you're gonna get. it's giving mystery box πŸ™ˆ

Morality: use die() if you mean it, and document the string as an exception. periodt. πŸ’…


πŸ’œ AUTHOR πŸ’œ

Raphael Manfredi <Raphael_Manfredi@pobox.com>

(we stan a legend 🫢)


πŸŽ€ SEE ALSO πŸŽ€


and that's the whole page!! no cap, you now know everything this manpage knows 🧚

perl v5.36.0 Β· 2022-10-15 Β· from the User Contributed Perl Documentation girlies, banner and all β€” mwah πŸ’–βœ¨πŸŒΈ

bye bestie, go log responsibly 🌟

πŸ“¦ where this page comes from