Skip to content
ingemar edited this page Feb 25, 2016 · 2 revisions

By default uses the standard ruby logger set to a level of ERROR and printing to STDOUT.

Logging is disabled by default. To enable logging add Koala::Utils.level = Logger::DEBUG.

Usage:

Koala::Utils.debug "message"
Koala::Utils.info "message"
Koala::Utils.warn "message"
Koala::Utils.error "message"
Koala::Utils.fatal "message"

To set the logger level:

Koala::Utils.level = Logger::DEBUG
Koala::Utils.level = Logger::INFO
Koala::Utils.level = Logger::WARN
Koala::Utils.level = Logger::ERROR
Koala::Utils.level = Logger::FATAL

Logging to a file

To send logs to a file:

Koala::Utils.logger = Logger.new("path/to/log")

Note: Doing this will set the level to DEBUG

Using a custom logger

A custom logger can be used as long as it responds to the methods #debug, #info, #warn, #error, #fatal, #level

To use a custom logger:

Koala::Utils.logger = MyCustomLogger.new
Clone this wiki locally