Log
const class Log : Obj
Log provides a simple, but standardized mechanism for logging.
Create a new log by name
The log level field defines which log entries are reported versus ignored
Return name
Install a handler to receive callbacks on logging events
Generate a LogLevel.debug log entry
Generate a LogLevel.err log entry
Publish a log entry
Return if error level is enabled
Uninstall a log handler
Return a list of all the active logs which have been registered since system startup
Return if debug level is enabled
Generate a LogLevel.warn log entry
Find a registered log by name
List all the handler functions installed to process log events
Find an existing registered log by name or if not found then create a new registered Log instance with the given name
Return if this log is enabled for the specified level
Return name of the log
Return if warn level is enabled
Return if info level is enabled
Generate a LogLevel.info log entry
static Void addHandler(|LogRec| handler)
Install a handler to receive callbacks on logging events. If the handler func is not immutable, then throw NotImmutableErr.
Void debug(Str msg, Err? err)
Generate a LogLevel.debug log entry.
Void err(Str msg, Err? err)
Generate a LogLevel.err log entry.
static Log? find(Str name, Bool checked)
Find a registered log by name. If the log doesn't exist and checked is false then return null, otherwise throw Err.
static Log get(Str name)
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.
static |LogRec|[] handlers()
List all the handler functions installed to process log events.
Void info(Str msg, Err? err)
Generate a LogLevel.info log entry.
Bool isDebug()
Return if debug level is enabled.
Bool isEnabled(LogLevel level)
Return if this log is enabled for the specified level.
Bool isErr()
Return if error level is enabled.
Bool isInfo()
Return if info level is enabled.
Bool isWarn()
Return if warn level is enabled.
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.
static Log[] list()
Return a list of all the active logs which have been registered since system startup.
virtual Void log(LogRec rec)
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.
new make(Str name, Bool register)
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.
Str name()
Return name of the log.
static Void removeHandler(|LogRec| handler)
Uninstall a log handler.
virtual Str toStr()
Return name.
Void warn(Str msg, Err? err)
Generate a LogLevel.warn log entry.