ConsoleLogger

ConsoleLogger

Interface some coloured terminal logging and syslog on Linux.

Provides four types of logs:

  • info (blue) - operational messages that require no action
  • log (yellow) - useful information (in terms of debugging for instance)
  • warn (magenta) - do not stops the execution but have the potential to
  • error (red) - errors that are stopping some operational flow

Provides an option to use syslog - print to systems log. This was tested on Ubuntu 16.04. To enable this, open /etc/rsyslog.conf and enable UDP on port 514. This is usually just commented and needs uncommenting:

    # provides UDP syslog reception
    module(load="imudp")
    input(type="imudp" port="514")

... and restart the service with ./etc/init.d/rsyslog restart. The logs should appear in /var/log/syslog.

To control the logging, use environmental variables:

  • DBTRC_SYSLOG_F set to OK to enable syslog logging
            DBTRC_SYSLOG_F=OK node ...
        
  • DBTRC_TERM_F set to OK to enable terminal logging
            DBTRC_TERM_F=OK node ...
        

Constructor

new ConsoleLogger(moduleName)

Source:
Parameters:
Name Type Description
moduleName string

the name of the module - something to represent the instance

Methods

error(logMessage)

Produce an error message.

Source:
Parameters:
Name Type Description
logMessage string

info(logMessage)

Produce a info message.

Source:
Parameters:
Name Type Description
logMessage string

log(logMessage)

Produce a log message.

Source:
Parameters:
Name Type Description
logMessage string

warn(logMessage)

Produce a warning message.

Source:
Parameters:
Name Type Description
logMessage string