ZoneMi...Logger(3pm)

πŸ“¦
version 1.36.37 Β· 5 versions
, in ubuntu resolute, ubuntu stonking

✨ 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 1 and above (currently only 1 for scripts) is considered debug
  • level 0 is considered informational
  • level -1 is a warning
  • level -2 is an error
  • level -3 is 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 β€” default INFO β€” the initial debug level, which defines which statements are output and which are ignored
  • trace β€” default 0 β€” whether to use the Carp::shortmess format in debug statements, so you can identify where the debug was emitted from
  • termLevel β€” default NOLOG β€” at what level debug is written to terminal standard error; 0 is no, 1 is yes, 2 is write only if terminal
  • databaseLevel β€” default INFO β€” at what level debug is written to the Log table in the database
  • fileLevel β€” default NOLOG β€” at what level debug is written to a log file of the format <id>.log in the standard log directory
  • syslogLevel β€” default INFO β€” 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 :constants tag will export the debug constants which define the various levels of debug
  • the :variables tag will export variables containing the current debug id and level
  • the :functions tag will export the debug functions β€” this or :all is what you would normally use
  • the :all tag will export all above symbols

πŸ’œ SEE ALSO πŸ’œ

  • Carp
  • Sys::Syslog

the ZoneMinder README file Troubleshooting section, for an extended discussion on the use and configuration of syslog with ZoneMinder πŸ‘€

http://www.zoneminder.com


πŸ‘‘ AUTHOR πŸ‘‘

Philip Coombes, <philip.coombes@zoneminder.com>


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