Agent:...orities(3pm)
β¨ NAME β¨
Log::Agent::Priorities β the lil glow-up translator between syslog priorities and logging levels π
(it's a Perl thing, from the User Contributed Perl Documentation corner of the universe, and yes bestie, the man page name is Agent:...orities(3pm) π)
πΈ SYNOPSIS πΈ
Not intended to be used directly
like... she's not for you to drive, she's for the module to drive π«Ά
π DESCRIPTION π
okay so this package is basically the group chat translator between syslog priorities and logging levels. that's it, that's the job. level_from_prio("crit") hands you back 2, and prio_from_level(4) gives you "warning" β and plot twist, prio_from_level(5) gives you "warning" too π same answer, different number, she contains multitudes.
Here's the whole roster of known priorities, bestie. each one can be abbreviated down to the first 2 letters, and it does not care about your capitalisation (case-insensitive, we don't judge π), and here's the logging level each one maps to:
noneβ level-1β export constantNONEβ (special, see the text below π)emergencyβ level0β traditional tokens:emerg,panicβ export constantEMERGalertβ level1β export constantALERTcriticalβ level2β traditional token:critβ export constantCRITerrorβ level3β traditional token:errβ export constantERRORwarningβ level4β export constantWARNnoticeβ level6β export constantNOTICEinfoβ level8β export constantINFOdebugβ level10β export constantDEBUG
the stuff in parenthesis up there is the traditional syslog priority tokens, for the historians. and yes, the levels 5, 7 and 9 are just... not there. they're being saved for a possible extension, like a spare room ποΈ. for now those numbers map to the level immediately below them.
the Export column is where the symbolic constants live β those are defined by this package. you can import them one by one, or grab the whole squad at once with the :LEVELS tag, like so:
use Log::Agent::Priorities qw(:LEVELS);
now, the special token none? she's for special occasions only and you have to spell her all the way out (no abbreviation privileges, she's too iconic for that π
). she maps to -1, and she's the move when you're specifying a logging level and you want literally nothing to be logged β like, none guarantees no logging happens, even for emergency situations. dead silent. not a peep. periodt.
here's the vibe anywhere a priority is expected: you can throw in a number and it gets taken as a logging level, or you can throw in a string and it gets taken as a priority. and if the default mapping above isn't giving for you, you can redefine it β for example by specifying notice:9. that gets taken as being level 9, but with a notice priority regardless, not info, which is what it would've been implicitly determined as otherwise. she's canonically notice, ok?? π
and the routine priority_level() is the one who unpacks all of this. she decompiles notice:9 into ("notice", 9), and apart from that she uses prio_from_level() or level_from_prio() to compute whatever information is missing. for example, give her critical and priority_level() returns the tuple ("critical", 2). chef's kiss, no notes π₯
π AUTHOR π
Raphael Manfredi <Raphael_Manfredi@pobox.com> β the main character who wrote her β¨
π¦ SEE ALSO π¦
and that's a wrap bestie!! π this whole lil page is from perl v5.36.0, dated 2022-10-15 β so like, she's been slaying since forever, we love a legacy icon ππ
π¦ where this page comes from
- ubuntu noble: liblog-agent-perl 1.005-2 Β· Artistic-2.0
- ubuntu resolute: liblog-agent-perl 1.005-2 Β· Artistic-2.0
- ubuntu stonking: liblog-agent-perl 1.005-2 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms