console()

console() : cs.js.Logger

This method returns the singleton Logger instance, and is the primary way to access the global logger. If the instance has not yet been configured, it is configured with the following defaults:

var $transport : cs.Transport
var $onfig; $format : Object

$format:=Logger.formats.combine(\
  Logger.formats.timestamp(New object("format"; "YYYY-MM-DD HH:mm:ss")); \
  Logger.formats.padLevels(); \
  Logger.formats.colorize(); \
  Logger.formats.format(New object("template"; "${timestamp} ${level}: ${message} ${metadata}"))\
  )

$transport:=cs.Transport.new("console"; cs.ConsoleTransport; New object("format"; $format))
$config:=New object("transports"; New collection($transport))
$console:=Logger.create("console"; $config)

Examples

Typically you will use this method to log and to configure the global logger.

console.info("Something interesting happened.")
console.warn("Beware the Ides of March!")
console.level:="debug"
Last Updated:
Contributors: Aparajita