---
name: "MDN::Log"
section: "3pm"
platform: "linux"
package: "libmdn-perl"
version: "2.4-2"
release: "Debian 3.1 (Sarge)"
platforms: ["linux"]
url: "https://new.carta.tech/MDN::Log"
---

# 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
