4. Logging

This section introduces the Haka logging API. The logs are used for various type of information about a running Haka.

haka.log.fatal(module, fmt[, ...])
haka.log.error(module, fmt[, ...])
haka.log.warning(module, fmt[, ...])
haka.log.info(module, fmt[, ...])
haka.log.debug(module, fmt[, ...])
Parameters:
  • module (string) – Name of the module issuing the log.
  • fmt (string) – Format string.
  • ... – Format arguments.

Log a message in corresponding level.

haka.log(module, fmt[, ...])

Alias to haka.log.info().

haka.log.message(level, module, fmt[, ...])
Parameters:
  • level (string) – Level for the log ('debug', 'info', 'warning', 'error' or 'fatal').
  • module (string) – Name of the module issuing the log.
  • fmt (string) – Format string.
  • ... – Format arguments.

Log a message.

haka.log.setlevel(level[, module])
Parameters:
  • level (string) – Level for the log ('debug', 'info', 'warning', 'error' or 'fatal').
  • module (string) – Name of the module to modify.

Set the logging level to display. It can be set globally and also manually for each module.

4.1. Example

haka.log("test", "error in packet %s", pkt)