Zonema...Logger(3pm)
π Zonemaster::Engine::Logger β the group chat of log entries π
okay bestie, so this is a Perl module from User Contributed Perl Documentation, and it is literally the class that holds Zonemaster::Engine::Logger::Entry objects. she's a keeper of receipts. a collector. a scrapbook of everything the engine had to say. π
β¨ SYNOPSIS β¨
my $logger = Zonemaster::Engine::Logger->new;
$logger->add( TAG => {some => 'arguments'});
that's it. that's the whole vibe. make one, feed her things. π«Ά
πΈ CONSTRUCTORS πΈ
newβ builds you a brand new object, fresh out the box, zero notes taken yet.
my $logger = Zonemaster::Engine::Logger->new;
π¦ ATTRIBUTES π¦
entriesβ a reference to an array, and inside that array live all yourZonemaster::Engine::Logger::Entryobjects. it's giving scrapbook. it's giving archive. πcallback($coderef)β set this and the code ref you hand over gets called every single time a log entry gets added. the code gets the newly created entry as its one and only argument, and whatever it returns? yeah, that's ignored, we don't care, no thoughts head empty. π
and now the important part, bestie, listen up: if your callback throws an exception and that exception is not an object of classZonemaster::Engine::Exception(or a subclass of it), that exception gets logged as a system message at the default level"CRITICAL"and thecallbackattribute gets cleared. gone. deleted. π
but if the exception is of (sub)class Zonemaster::Engine::Exception, then it just gets rethrown, over and over, until it reaches the code that started the test run that logged the message. it's a whole relay race. πββοΈ
π METHODS π
add($tag, $argref, $module, $testcase)β adds an entry with the given tag and arguments to the logger object. iconic behaviour honestly.
$module is optional and defaults to $Zonemaster::Engine::Logger::MODULE_NAME if you don't set it.
$testcase is optional and defaults to $Zonemaster::Engine::Logger::TEST_CASE_NAME if you don't set it.
and here's the tea: $Zonemaster::Engine::Logger::MODULE_NAME and $Zonemaster::Engine::Logger::TEST_CASE_NAME can be dynamically set to change the default module ("System") or test case name ("Unspecified"). so you can swap the defaults out whenever. slay. π₯
json([$level])β hands you back a JSON-formatted string containing all the stored log entries. and if you pass an argument that's a known severity level, you only get the messages at at least that level. filtering? we love to see it. β¨get_max_levelβ returns the maximum log level from the entire log, as the level string. the biggest, the baddest, the loudest. π
π CLASS METHODS π
start_time_now()β sets the logger's start time to the current time. right now. this very second. β°clear_history()β removes all known log entries. yeah. everything. no cap, everything's gone. πreset_config()β clears the test level cached configuration. fresh start energy. π
π§ SUBROUTINES π§
_check_filter($entry)β applies the"logfilter"defined rules to the entry. see"logfilter"inZonemaster::Engine::Profilefor the deets. iykyk. π
and that's the whole page, bestie! π this little gem shipped with perl v5.40.1 and was dated 2026-03-21 β go forth and log responsibly πβ¨πΈ
π¦ where this page comes from
- ubuntu stonking: libzonemaster-perl 8.001.001-1 Β· BSD-2-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms