.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" 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 .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Munin::Common::Logger 3pm" .TH Munin::Common::Logger 3pm "2022-02-10" "perl v5.34.0" "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" Munin::Common::Logger \- Perl extension for blah blah blah .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Munin::Common::Logger; \& \& DEBUG("blah, blah, blah"); \& INFO("blah, blah, blah"); \& NOTICE("blah, blah, blah"); \& WARNING("blah, blah, blah"); \& ERROR("blah, blah, blah"); \& CRITICAL("blah, blah, blah"); \& ALERT("blah, blah, blah"); \& EMERGENCY("oops"); \& LOGCROAK("Goodbye, world!"); \& \& DEBUG(slow_and_expensive_operation) if Munin::Common::Logger::would_log(\*(Aqdebug\*(Aq); \& \& Munin::Common::Logger::configure( level => \*(Aqdebug\*(Aq) if $debug; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Munin::Common::Logger handles logging for Munin. .PP It uses Log::Dispatch for this, and exports utility functions to enable logging from other parts of Munin. .PP To help transition from previous logging modules: .IP "Functions are similar to Log4perl" 4 .IX Item "Functions are similar to Log4perl" The functions used are similar to Log4perl, to make the number of code changes minimal. .IP "Log messages are changed" 4 .IX Item "Log messages are changed" The \*(L"[\s-1SEVERITY\s0]\*(R" prefix in the existing log messages are removed by Munin::Common::Logger. Severity is set by the function used to log, and used in the output formatting. .SS "\s-1EXPORT\s0" .IX Subsection "EXPORT" The functions \s-1DEBUG, INFO, NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY\s0 and \s-1LOGCROAK\s0 are exported by default. .SH "FUNCTIONS" .IX Header "FUNCTIONS" .ie n .IP "configure { level => $level, output => $output }" 4 .el .IP "configure { level => \f(CW$level\fR, output => \f(CW$output\fR }" 4 .IX Item "configure { level => $level, output => $output }" .Vb 1 \& configure { level => \*(Aqerror\*(Aq, output => \*(Aqscreen\*(Aq} \& \& configure { level => \*(Aqdebug\*(Aq, output => \*(Aqsyslog\*(Aq} .Ve .Sp Removes the default logging, and replaces it with the configured log output. .Sp Option \*(L"level\*(R" sets the minimum log level. Takes one argument, which is the log level to accept. Optional, default is \*(L"warning\*(R". .Sp See Log::Dispatch for a list of valid log levels. .Sp Option \*(L"output\*(R" sets the log output. Valid outputs are 'screen' and 'syslog'. Optional, default is \&\*(L"syslog\*(R". .IP "would_log" 4 .IX Item "would_log" Returns true if a message would be logged given the log level. Takes one argument, which is the log level to check. .Sp Use this around expensive log statements, to skip them if they would not be logged. .Sp See Log::Dispatch for a list of valid log levels. .IP "\s-1DEBUG\s0" 4 .IX Item "DEBUG" Log with \s-1DEBUG\s0 priority. Takes one argument, which is the string to log. .IP "\s-1INFO\s0" 4 .IX Item "INFO" Log with \s-1INFO\s0 priority. Takes one argument, which is the string to log. .IP "\s-1NOTICE\s0" 4 .IX Item "NOTICE" Log with \s-1NOTICE\s0 priority. Takes one argument, which is the string to log. .IP "\s-1WARN\s0" 4 .IX Item "WARN" Log with \s-1WARNING\s0 priority. Takes one argument, which is the string to log. .IP "\s-1WARNING\s0" 4 .IX Item "WARNING" Log with \s-1WARNING\s0 priority. Takes one argument, which is the string to log. .IP "\s-1ERROR\s0" 4 .IX Item "ERROR" Log with \s-1ERROR\s0 priority. Takes one argument, which is the string to log. .IP "\s-1CRITICAL\s0" 4 .IX Item "CRITICAL" Log with \s-1CRITICAL\s0 priority. Takes one argument, which is the string to log. .IP "\s-1EMERGENCY\s0" 4 .IX Item "EMERGENCY" Log with \s-1EMERGENCY\s0 priority. Takes one argument, which is the string to log. .IP "\s-1ALERT\s0" 4 .IX Item "ALERT" Log with \s-1ALERT\s0 priority. Takes one argument, which is the string to log. .IP "\s-1FATAL\s0" 4 .IX Item "FATAL" Log with \s-1FATAL\s0 priority. Takes one argument, which is the string to log. .IP "\s-1LOGCROAK\s0" 4 .IX Item "LOGCROAK" Log with \s-1CRITIAL\s0 priority exit the program. Takes one argument, which is the string to log. .Sp See also \f(CW\*(C`log_and_croak\*(C'\fR in Log::Dispatch. .SH "SEE ALSO" .IX Header "SEE ALSO" Mention other useful documentation such as the documentation of related modules or operating system documentation (such as man pages in \s-1UNIX\s0), or any relevant external documentation such as RFCs or standards. .PP If you have a mailing list set up for your module, mention it here. .PP If you have a web site set up for your module, mention it here. .SH "AUTHOR" .IX Header "AUTHOR" Stig Sandbeck Mathisen, .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" Copyright (C) 2014 by Stig Sandbeck Mathisen .PP This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.2 or, at your option, any later version of Perl 5 you may have available. .SH "BUGS" .IX Header "BUGS" None reported... yet.