logo

Logging

Log Creation

// get or create a log named "acme"
const static Log log = Log.get("acme")

// find an existing log
Log.find("acme")          // throw exception if not found
Log.find("acme", false)   // return null if not found

// list all the active logs
Log.list

// get the standard log for a type's pod
pod.log
type.log
obj.type.log

See docLang for details.

Logging Statements

log.error("The freaking file didn't load", err)
log.info("CatchRoadRoader service started on port $port")

// this code performs string concatenation on every call
log.debug("The values are x=$x, y=$y, and z=$z")

// this code performs string concatenation only when needed
if (log.isDebug)
  log.debug("The values are x=$x, y=$y, and z=$z")

See docLang for details.

Handlers

Log.addHandler |LogRecord rec| { echo("My Handler: $rec") }

See docLang for details.