Zonema...Logger(3pm)
π Zonemaster::Logger β the manual, but make it cute π
okay bestie, welcome to Zonemaster::Logger, straight out of the User Contributed Perl Documentation corner of the perl world. this class is literally the keeper of all the Zonemaster::Logger::Entry objects β like, it's the group chat and the entries are the messages. she holds them. she loves them. she's the main character of logging. π
β¨ SYNOPSIS β¨
my $logger = Zonemaster::Logger->new;
$logger->add( TAG => {some => 'arguments'});
that's it. that's the vibe. make a logger, add a tag with your lil arguments hashref, slay. π
πΈ ATTRIBUTES πΈ
entriesβ a reference to an array that's holding all yourZonemaster::Logger::Entryobjects. it's giving storage unit for log entries. ποΈcallback($coderef)β set this attribute and your given code reference gets called every single time a log entry is added. every time. obsessed with the dedication fr fr. the referenced code is called with the newly created entry as its single argument β one argument, that's the whole meal β and the return value of the called code is ignored. it said "i don't care what you give back to me." π
β οΈ now the serious part, and i need you locked in: if the called code throws an exception, and that exception is not an object of classZonemaster::Exception(or a subclass of it), then that exception gets logged as a system message at the default level"CRITICAL"and the callback attribute gets cleared. gone. deleted. the callback said "i'm out." π
and if an exception that is of (sub)class Zonemaster::Exception gets called? then the exception is simply rethrown until it reaches the code that started the test run that logged the message. it's traveling. it's on a journey. it will find its home. π¦
π₯ METHODS π₯
add($tag, $argref)β adds an entry with the given tag and arguments to the logger object. the core move. the moment. the whole point of the class, no cap. β¨json([$level])β returns a JSON-formatted string with all the stored log entries. and if you give it an argument and that argument is a known severity level, only messages with at least that level get included. filtering queen. πget_max_levelβ returns the maximum log level from the entire log, as the level string. she looked at everything and found the biggest one. iconic behavior. π
π CLASS METHOD π
start_time_now()β sets the logger's start time to the current time. right now. this instant. clocked in. β°clear_history()β removes all known log entries. memory wiped. fresh start. we don't talk about the old logs anymore. π«Ά
and that's the whole page, bestie β no detail left behind, every attribute and method accounted for. π
sign-off time: this lovely little page comes to you as part of perl v5.32.0, dated 2021-01-06. mwah. take care of her. πβ¨π
π¦ where this page comes from
- ubuntu jammy: libzonemaster-perl 1.0.16-2.1 Β· BSD-2-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms