logo

const class

sys::Log

sys::Obj
  sys::Log

Log provides a simple, but standardized mechanism for logging.

See docLang::Logging for details. See docCookbook::Logging for coding examples.

Slots

addHandler

static Void addHandler(|LogRecord| handler)

Install a handler to receive callbacks on logging events. If the handler func is not immutable, then throw NotImmutableErr.

Source

debug

Void debug(Str message, Err err := null)

Generate a LogLevel.debug log entry.

Source

error

Void error(Str message, Err err := null)

Generate a LogLevel.error log entry.

Source

find

static Log find(Str name, Bool checked := true)

Find a log by name. If the log doesn't exist and checked is false then return null, otherwise throw Err.

Source

get

static Log get(Str name)

Find an existing log by name or if not found then create a new Log instance with the given name. Name must be valid according to Uri.isName otherwise NameErr is thrown.

Source

handlers

static |LogRecord|[] handlers()

List all the handler functions installed to process log events.

Source

info

Void info(Str message, Err err := null)

Generate a LogLevel.info log entry.

Source

isDebug

Bool isDebug()

Return if debug level is enabled.

Source

isEnabled

Bool isEnabled(LogLevel level)

Return if this log is enabled for the specified level.

Source

isError

Bool isError()

Return if error level is enabled.

Source

isInfo

Bool isInfo()

Return if info level is enabled.

Source

isWarn

Bool isWarn()

Return if warn level is enabled.

Source

level

LogLevel level

The log level field defines which log entries are reported versus ignored. Anything which equals or is more severe than the log level is logged. Anything less severe is ignored. If the level is set to silent, then logging is disabled.

Source

list

static Log[] list()

Return a list of all the active logs which have been created since system startup.

Source

log

virtual Void log(LogRecord rec)

Publish a log entry. The convenience methods error, warn info, and debug all route to this method for centralized handling. The standard implementation is to call each of the installed handlers if the specified level is enabled.

Source

make

new make(Str name)

Create a new log by name. If a log has already been created for the specified name then throw ArgErr. Name must be valid according to Uri.isName otherwise NameErr is thrown.

Source

name

Str name()

Return name of the log.

Source

removeHandler

static Void removeHandler(|LogRecord| handler)

Uninstall a log handler.

Source

toStr

override Str toStr()

Return name.

Source

warn

Void warn(Str message, Err err := null)

Generate a LogLevel.warn log entry.

Source