ZoneMi...Logger(3pm)
β¨ ZoneMinder::Logger β¨
okay so bestie, welcome to ZoneMinder::Logger(3pm) π this is the ZoneMinder Logger module and honestly? it's the one holding the whole group chat together. every message your scripts scream into the void goes through here, and it makes them look cute and consistent while doing it. no cap.
πΈ NAME πΈ
ZoneMinder::Logger β the ZoneMinder Logger module. that's it, that's the name, she's simple, she's iconic π
π¦ SYNOPSIS π¦
use ZoneMinder::Logger;
use ZoneMinder::Logger qw(:all);
logInit( 'myproc', DEBUG );
Debug( 'This is what is happening' );
Info( 'Something interesting is happening' );
Warning( 'Something might be going wrong.' );
Error( 'Something has gone wrong!!' );
Fatal( 'Something has gone badly wrong, gotta stop!!' );
Panic( 'Something fundamental has gone wrong, die with stack trace' );
look at her go. six whole moods, from "just vibing" to "everything is on fire and we are getting a stack trace" π
π DESCRIPTION π
so the ZoneMinder:Logger module is where the common debug and error reporting routines live β the ones all the ZoneMinder scripts use. it's giving shared infrastructure, it's giving main character support system.
to use debug in your scripts you need to include this module and call logInit. after that you can sprinkle Debug or Error calls etc. all over the code, safe in the knowledge that they'll get reported to your error log β and possibly the syslogger β in a meaningful and consistent format. like, they will show up, they will be formatted, they will not be a mess. obsessed π«Ά
now, Debug gets discussed in terms of levels, so let's do a vibe check:
- level
1and above (currently only1for scripts) is considered debug - level
0is considered informational - level
-1is a warning - level
-2is an error - level
-3is a fatal error or panic
where levels are mentioned below as thresholds, the value given and anything with a lower level (ie. more serious) will be included. so a threshold is a "this serious and worse" filter, not an exact match. periodt.
π METHODS π
logInit ( $id, %options );
initialises the debug and gets the logging prepped for everything that's coming. if you don't call it explicitly, it'll get called by the first debug call in your script anyway β but with default (and probably meaningless) options, so likeβ¦ do it yourself bestie, don't let the defaults decide your fate π
the only compulsory argument is $id, which must be a string that will identify debug coming from this script in mixed logs (aka your name tag at the party).
other options may be provided as below:
levelβ defaultINFOβ the initial debug level, which defines which statements are output and which are ignoredtraceβ default0β whether to use theCarp::shortmessformat in debug statements, so you can identify where the debug was emitted fromtermLevelβ defaultNOLOGβ at what level debug is written to terminal standard error;0is no,1is yes,2is write only if terminaldatabaseLevelβ defaultINFOβ at what level debug is written to theLogtable in the databasefileLevelβ defaultNOLOGβ at what level debug is written to a log file of the format<id>.login the standard log directorysyslogLevelβ defaultINFOβ at what level debug is written to syslog
to disable any of these actions entirely, set it to NOLOG. fully ghosted. no output. slay π
logTerm ();
used to end the debug session and close any logs etc. not usually necessary β she can handle herself, this is just the polite goodbye wave π«Ά
the getter/setter girlies π
$id = logId ( [$id] );
$level = logLevel ( [$level] );
$trace = logTrace ( [$trace] );
$level = logLevel ( [$level] );
$termLevel = logTermLevel ( [$termLevel] );
$databaseLevel = logDatabaseLevel ( [$databaseLevel] );
$fileLevel = logFileLevel ( [$fileLevel] );
$syslogLevel = logSyslogLevel ( [$syslogLevel] );
these methods can be used to get and set the current settings as defined in logInit. yes, logLevel is listed twice up there β i did not do that, the source did, and i am not touching it, that's not my business βπ
Debug( $string );
outputs a debug message if the current debug level permits it, otherwise does nothing. this message will be tagged with the DBG string in the logs.
Info( $string );
outputs an informational message if the current debug level permits it, otherwise does nothing. this message will be tagged with the INF string in the logs.
Warning( $string );
outputs a warning message if the current debug level permits it, otherwise does nothing. this message will be tagged with the WAR string in the logs.
Error( $string );
outputs an error message if the current debug level permits it, otherwise does nothing. this message will be tagged with the ERR string in the logs.
Fatal( $string );
outputs a fatal error message and then dies β if the current debug level permits it, otherwise does nothing. this message will be tagged with the FAT string in the logs. she said goodbye and she meant it π
Panic( $string );
outputs a panic error message and then dies with a stack trace β if the current debug level permits it, otherwise does nothing. this message will be tagged with the PNC string in the logs. that's the full dramatic exit, receipts included π₯
π§ EXPORT π§
None by default.
- the
:constantstag will export the debug constants which define the various levels of debug - the
:variablestag will export variables containing the current debug id and level - the
:functionstag will export the debug functions β this or:allis what you would normally use - the
:alltag will export all above symbols
π SEE ALSO π
CarpSys::Syslog
the ZoneMinder README file Troubleshooting section, for an extended discussion on the use and configuration of syslog with ZoneMinder π
π AUTHOR π
Philip Coombes, <philip.coombes@zoneminder.com>
π COPYRIGHT AND LICENSE π
Copyright (C) 2001-2008 Philip Coombes
this library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.3 or, at your option, any later version of Perl 5 you may have available.
and that's the whole page bestie, we ate and left no crumbs π
this little beauty came to you via perl v5.40.1, dated 2026-02-01, and it's the ZoneMi...Logger(3pm) page from the User Contributed Perl Documentation. mwah, go log something πβ¨
π¦ where this page comes from
- ubuntu resolute: zoneminder 1.36.37+dfsg1-1 Β· GPL-2.0-or-later
- ubuntu stonking: zoneminder 1.36.37+dfsg1-1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms