Scroll to navigation

Munin::Common::Logger(3pm) User Contributed Perl Documentation Munin::Common::Logger(3pm)

NAME

Munin::Common::Logger - Perl extension for blah blah blah

SYNOPSIS

   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('debug');
   Munin::Common::Logger::configure( level => 'debug') if $debug;

DESCRIPTION

Munin::Common::Logger handles logging for Munin.

It uses Log::Dispatch for this, and exports utility functions to enable logging from other parts of Munin.

To help transition from previous logging modules:

The functions used are similar to Log4perl, to make the number of code changes minimal.
The "[SEVERITY]" 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.

EXPORT

The functions DEBUG, INFO, NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY and LOGCROAK are exported by default.

FUNCTIONS

  configure { level => 'error', output => 'screen'}
  configure { level => 'debug', output => 'syslog'}
    

Removes the default logging, and replaces it with the configured log output.

Option "level" sets the minimum log level. Takes one argument, which is the log level to accept. Optional, default is "warning".

See Log::Dispatch for a list of valid log levels.

Option "output" sets the log output. Valid outputs are 'screen' and 'syslog'. Optional, default is "syslog".

Returns true if a message would be logged given the log level. Takes one argument, which is the log level to check.

Use this around expensive log statements, to skip them if they would not be logged.

See Log::Dispatch for a list of valid log levels.

Log with DEBUG priority. Takes one argument, which is the string to log.
Log with INFO priority. Takes one argument, which is the string to log.
Log with NOTICE priority. Takes one argument, which is the string to log.
Log with WARNING priority. Takes one argument, which is the string to log.
Log with WARNING priority. Takes one argument, which is the string to log.
Log with ERROR priority. Takes one argument, which is the string to log.
Log with CRITICAL priority. Takes one argument, which is the string to log.
Log with EMERGENCY priority. Takes one argument, which is the string to log.
Log with ALERT priority. Takes one argument, which is the string to log.
Log with FATAL priority. Takes one argument, which is the string to log.
Log with CRITIAL priority exit the program. Takes one argument, which is the string to log.

See also "log_and_croak" in Log::Dispatch.

SEE ALSO

Mention other useful documentation such as the documentation of related modules or operating system documentation (such as man pages in UNIX), or any relevant external documentation such as RFCs or standards.

If you have a mailing list set up for your module, mention it here.

If you have a web site set up for your module, mention it here.

AUTHOR

Stig Sandbeck Mathisen, <ssm@fnord.no>

COPYRIGHT AND LICENSE

Copyright (C) 2014 by Stig Sandbeck Mathisen

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.

BUGS

None reported... yet.

2022-02-10 perl v5.34.0