Reference

MDN::Log(3pm)

Perl extension for libmdn log module.

NAME

MDN::Log - Perl extension for libmdn log module.

SYNOPSIS

  use MDN::Log;
  MDN::Log->setproc_none();
  MDN::Log->setproc_stderr();
  MDN::Log->setlevel('warning');
  $level = MDN::Log->getlevel();

DESCRIPTION

"MDN::Log" provides a Perl interface to the log module of the MDN library (a C library for handling multilingual domain names) in the mDNkit.

With this module you can control how log messages are handled.

CLASS METHODS

Although this module does not provide object interface, all the functions should be called as class methods, in order to be consistent with other modules in "MDN::".

        MDN::Log->setlevel('warning');  # OK
        MDN::Log::setlevel('warning');  # NG

setlevel($level)

Sets log level to $level. Valid values for $level are 'fatal', 'error', 'warning', 'info', 'trace', and 'debug'.

The default level is determined by the value of the enrironment variable "MDN_LOG_LEVEL".

getlevel()

Returns the current log level.

setproc_stderr()

Resets the log handler to the default one, which outputs the log messages to standard error.

setproc_none()

Sets the log handler to the one which does nothing.

setproc([&handler])

Sets log handler to &handler. &handler receives log level and message string as arguments in that order.

        sub my_handler {
            my ($level, $message) = @_;
            # (process log message...)
        }

If &handler is ommited, log handler is reset to the default one. This is the same as "setproc_stderr()".

SEE ALSO

MDN library specification