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 your Zonemaster::Engine::Logger::Entry objects. 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 class Zonemaster::Engine::Exception (or a subclass of it), that exception gets logged as a system message at the default level "CRITICAL" and the callback attribute 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" in Zonemaster::Engine::Profile for 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