.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "ZoneMinder::Logger 3pm" .TH ZoneMinder::Logger 3pm "2022-09-24" "perl v5.32.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" ZoneMinder::Logger \- ZoneMinder Logger module .SH "SYNOPSIS" .IX Header "SYNOPSIS" use ZoneMinder::Logger; use ZoneMinder::Logger qw(:all); .PP logInit( 'myproc', \s-1DEBUG\s0 ); .PP 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' ); .SH "DESCRIPTION" .IX Header "DESCRIPTION" The ZoneMinder:Logger module contains the common debug and error reporting routines used by the ZoneMinder scripts. .PP To use debug in your scripts you need to include this module, and call logInit. Thereafter you can sprinkle Debug or Error calls etc throughout the code safe in the knowledge that they will be reported to your error log, and possibly the syslogger, in a meaningful and consistent format. .PP Debug is discussed in terms of levels where 1 and above (currently only 1 for scripts) is considered debug, 0 is considered as informational, \-1 is a warning, \-2 is an error and \-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. .SH "METHODS" .IX Header "METHODS" .ie n .IP "logInit ( $id, %options );" 4 .el .IP "logInit ( \f(CW$id\fR, \f(CW%options\fR );" 4 .IX Item "logInit ( $id, %options );" Initialises the debug and prepares the logging for forthcoming operations. If not called explicitly it will be called by the first debug call in your script, but with default (and probably meaningless) options. The only compulsory arguments are \f(CW$id\fR which must be a string that will identify debug coming from this script in mixed logs. Other options may be provided as below, .Sp Option Default Description \&\-\-\-\-\-\-\-\-\- \-\-\-\-\-\-\-\-\- \-\-\-\-\-\-\-\-\-\-\- level \s-1INFO\s0 The initial debug level which defines which statements are output and which are ignored trace 0 Whether to use the Carp::shortmess format in debug statements to identify where the debug was emitted from termLevel \s-1NOLOG\s0 At what level debug is written to terminal standard error, 0 is no, 1 is yes, 2 is write only if terminal databaseLevel \s-1INFO\s0 At what level debug is written to the Log table in the database; fileLevel \s-1NOLOG\s0 At what level debug is written to a log file of the format of .log in the standard log directory. syslogLevel \s-1INFO\s0 At what level debug is written to syslog. .Sp To disable any of these action entirely set to \s-1NOLOG\s0 .IP "logTerm ();" 4 .IX Item "logTerm ();" Used to end the debug session and close any logs etc. Not usually necessary. .ie n .IP "$id = logId ( [$id] );" 4 .el .IP "\f(CW$id\fR = logId ( [$id] );" 4 .IX Item "$id = logId ( [$id] );" .PD 0 .ie n .IP "$level = logLevel ( [$level] );" 4 .el .IP "\f(CW$level\fR = logLevel ( [$level] );" 4 .IX Item "$level = logLevel ( [$level] );" .ie n .IP "$trace = logTrace ( [$trace] );" 4 .el .IP "\f(CW$trace\fR = logTrace ( [$trace] );" 4 .IX Item "$trace = logTrace ( [$trace] );" .ie n .IP "$level = logLevel ( [$level] );" 4 .el .IP "\f(CW$level\fR = logLevel ( [$level] );" 4 .IX Item "$level = logLevel ( [$level] );" .ie n .IP "$termLevel = logTermLevel ( [$termLevel] );" 4 .el .IP "\f(CW$termLevel\fR = logTermLevel ( [$termLevel] );" 4 .IX Item "$termLevel = logTermLevel ( [$termLevel] );" .ie n .IP "$databaseLevel = logDatabaseLevel ( [$databaseLevel] );" 4 .el .IP "\f(CW$databaseLevel\fR = logDatabaseLevel ( [$databaseLevel] );" 4 .IX Item "$databaseLevel = logDatabaseLevel ( [$databaseLevel] );" .ie n .IP "$fileLevel = logFileLevel ( [$fileLevel] );" 4 .el .IP "\f(CW$fileLevel\fR = logFileLevel ( [$fileLevel] );" 4 .IX Item "$fileLevel = logFileLevel ( [$fileLevel] );" .ie n .IP "$syslogLevel = logSyslogLevel ( [$syslogLevel] );" 4 .el .IP "\f(CW$syslogLevel\fR = logSyslogLevel ( [$syslogLevel] );" 4 .IX Item "$syslogLevel = logSyslogLevel ( [$syslogLevel] );" .PD These methods can be used to get and set the current settings as defined in logInit. .ie n .IP "Debug( $string );" 4 .el .IP "Debug( \f(CW$string\fR );" 4 .IX Item "Debug( $string );" This method will output a debug message if the current debug level permits it, otherwise does nothing. This message will be tagged with the \s-1DBG\s0 string in the logs. .ie n .IP "Info( $string );" 4 .el .IP "Info( \f(CW$string\fR );" 4 .IX Item "Info( $string );" This method will output an informational message if the current debug level permits it, otherwise does nothing. This message will be tagged with the \&\s-1INF\s0 string in the logs. .ie n .IP "Warning( $string );" 4 .el .IP "Warning( \f(CW$string\fR );" 4 .IX Item "Warning( $string );" This method will output a warning message if the current debug level permits it, otherwise does nothing. This message will be tagged with the \&\s-1WAR\s0 string in the logs. .ie n .IP "Error( $string );" 4 .el .IP "Error( \f(CW$string\fR );" 4 .IX Item "Error( $string );" This method will output an error message if the current debug level permits it, otherwise does nothing. This message will be tagged with the \s-1ERR\s0 string in the logs. .ie n .IP "Fatal( $string );" 4 .el .IP "Fatal( \f(CW$string\fR );" 4 .IX Item "Fatal( $string );" This method will output a fatal error message and then die if the current debug level permits it, otherwise does nothing. This message will be tagged with the \s-1FAT\s0 string in the logs. .ie n .IP "Panic( $string );" 4 .el .IP "Panic( \f(CW$string\fR );" 4 .IX Item "Panic( $string );" This method will output a panic error message and then die with a stack trace if the current debug level permits it, otherwise does nothing. This message will be tagged with the \s-1PNC\s0 string in the logs. .SS "\s-1EXPORT\s0" .IX Subsection "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. .SH "SEE ALSO" .IX Header "SEE ALSO" Carp Sys::Syslog .PP The ZoneMinder \s-1README\s0 file Troubleshooting section for an extended discussion on the use and configuration of syslog with ZoneMinder. .PP http://www.zoneminder.com .SH "AUTHOR" .IX Header "AUTHOR" Philip Coombes, .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" Copyright (C) 2001\-2008 Philip Coombes .PP 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.