const class sys::Log

sys::Obj
  sys::Log

Source

Log provides a simple, but standardized mechanism for logging.

See Logging for details and examples.

addHandler

static Void addHandler(|LogRec| handler)

Source

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

debug

Void debug(Str msg, Err? err := null)

Source

Generate a LogLevel.debug log entry.

err

Void err(Str msg, Err? err := null)

Source

Generate a LogLevel.err log entry.

find

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

Source

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

get

static Log get(Str name)

Source

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

handlers

static |LogRec|[] handlers()

Source

List all the handler functions installed to process log events.

info

Void info(Str msg, Err? err := null)

Source

Generate a LogLevel.info log entry.

isDebug

Bool isDebug()

Source

Return if debug level is enabled.

isEnabled

Bool isEnabled(LogLevel level)

Source

Return if this log is enabled for the specified level.

isErr

Bool isErr()

Source

Return if error level is enabled.

isInfo

Bool isInfo()

Source

Return if info level is enabled.

isWarn

Bool isWarn()

Source

Return if warn level is enabled.

level

LogLevel level

Source

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.

list

static Log[] list()

Source

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

log

virtual Void log(LogRec rec)

Source

Publish a log entry. The convenience methods err, 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.

make

new make(Str name, Bool register)

Source

Create a new log by name. The log is added to the VM log registry only if register is true. If register is true and 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.

name

Str name()

Source

Return name of the log.

removeHandler

static Void removeHandler(|LogRec| handler)

Source

Uninstall a log handler.

toStr

virtual override Str toStr()

Source

Return name.

warn

Void warn(Str msg, Err? err := null)

Source

Generate a LogLevel.warn log entry.