kernel/logging/logger
Classes
Section titled “Classes”FanOutLogSink
Section titled “FanOutLogSink”Defined in: app/src/kernel/logging/logger.ts:187
Writes every record to several sinks.
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new FanOutLogSink(
sinks):FanOutLogSink
Defined in: app/src/kernel/logging/logger.ts:191
Parameters
Section titled “Parameters”readonly LogSink[]
Destinations; each receives every record.
Returns
Section titled “Returns”Methods
Section titled “Methods”write()
Section titled “write()”write(
record):void
Defined in: app/src/kernel/logging/logger.ts:196
Writes one record.
Parameters
Section titled “Parameters”record
Section titled “record”The record to write.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”RingBufferLogSink
Section titled “RingBufferLogSink”Defined in: app/src/kernel/logging/logger.ts:163
Keeps the most recent records in memory, for the diagnostics page and for tests.
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new RingBufferLogSink(
capacity?):RingBufferLogSink
Defined in: app/src/kernel/logging/logger.ts:168
Parameters
Section titled “Parameters”capacity?
Section titled “capacity?”number = 1000
Maximum number of records kept.
Returns
Section titled “Returns”Accessors
Section titled “Accessors”records
Section titled “records”Get Signature
Section titled “Get Signature”get records(): readonly
LogRecord[]
Defined in: app/src/kernel/logging/logger.ts:181
The kept records, oldest first.
Returns
Section titled “Returns”readonly LogRecord[]
Methods
Section titled “Methods”write()
Section titled “write()”write(
record):void
Defined in: app/src/kernel/logging/logger.ts:173
Writes one record.
Parameters
Section titled “Parameters”record
Section titled “record”The record to write.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”SinkLogger
Section titled “SinkLogger”Defined in: app/src/kernel/logging/logger.ts:74
A Logger that filters by level and writes records to a LogSink.
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new SinkLogger(
sink,clock,options):SinkLogger
Defined in: app/src/kernel/logging/logger.ts:85
Parameters
Section titled “Parameters”Destination of the records.
Source of timestamps.
options
Section titled “options”Scope and minimum level.
Returns
Section titled “Returns”Properties
Section titled “Properties”
readonlyscope:string
Defined in: app/src/kernel/logging/logger.ts:75
Scope of this logger.
Implementation of
Section titled “Implementation of”Methods
Section titled “Methods”child()
Section titled “child()”child(
scope):Logger
Defined in: app/src/kernel/logging/logger.ts:123
Creates a logger for a sub-scope that writes to the same sink.
Parameters
Section titled “Parameters”string
Appended to this logger’s scope with a dot.
Returns
Section titled “Returns”Implementation of
Section titled “Implementation of”debug()
Section titled “debug()”debug(
message,fields?):void
Defined in: app/src/kernel/logging/logger.ts:103
Logs diagnostics for developers.
Parameters
Section titled “Parameters”message
Section titled “message”string
fields?
Section titled “fields?”Readonly<Record<string, unknown>>
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”error()
Section titled “error()”error(
message,error?,fields?):void
Defined in: app/src/kernel/logging/logger.ts:118
Logs a failure, with the error that caused it.
Parameters
Section titled “Parameters”message
Section titled “message”string
error?
Section titled “error?”unknown
fields?
Section titled “fields?”Readonly<Record<string, unknown>>
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”info()
Section titled “info()”info(
message,fields?):void
Defined in: app/src/kernel/logging/logger.ts:108
Logs a normal, noteworthy event.
Parameters
Section titled “Parameters”message
Section titled “message”string
fields?
Section titled “fields?”Readonly<Record<string, unknown>>
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”isEnabled()
Section titled “isEnabled()”isEnabled(
level):boolean
Defined in: app/src/kernel/logging/logger.ts:93
Parameters
Section titled “Parameters”A level.
Returns
Section titled “Returns”boolean
Whether records of that level are written.
Implementation of
Section titled “Implementation of”trace()
Section titled “trace()”trace(
message,fields?):void
Defined in: app/src/kernel/logging/logger.ts:98
Logs very detailed diagnostics.
Parameters
Section titled “Parameters”message
Section titled “message”string
fields?
Section titled “fields?”Readonly<Record<string, unknown>>
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”warn()
Section titled “warn()”warn(
message,fields?):void
Defined in: app/src/kernel/logging/logger.ts:113
Logs an unexpected condition that the browser recovered from.
Parameters
Section titled “Parameters”message
Section titled “message”string
fields?
Section titled “fields?”Readonly<Record<string, unknown>>
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”Interfaces
Section titled “Interfaces”Logger
Section titled “Logger”Defined in: app/src/kernel/logging/logger.ts:41
Structured logging API used by the kernel, the domain and every module.
Properties
Section titled “Properties”
readonlyscope:string
Defined in: app/src/kernel/logging/logger.ts:43
Scope of this logger.
Methods
Section titled “Methods”child()
Section titled “child()”child(
scope):Logger
Defined in: app/src/kernel/logging/logger.ts:60
Creates a logger for a sub-scope that writes to the same sink.
Parameters
Section titled “Parameters”string
Appended to this logger’s scope with a dot.
Returns
Section titled “Returns”debug()
Section titled “debug()”debug(
message,fields?):void
Defined in: app/src/kernel/logging/logger.ts:49
Logs diagnostics for developers.
Parameters
Section titled “Parameters”message
Section titled “message”string
fields?
Section titled “fields?”Readonly<Record<string, unknown>>
Returns
Section titled “Returns”void
error()
Section titled “error()”error(
message,error?,fields?):void
Defined in: app/src/kernel/logging/logger.ts:55
Logs a failure, with the error that caused it.
Parameters
Section titled “Parameters”message
Section titled “message”string
error?
Section titled “error?”unknown
fields?
Section titled “fields?”Readonly<Record<string, unknown>>
Returns
Section titled “Returns”void
info()
Section titled “info()”info(
message,fields?):void
Defined in: app/src/kernel/logging/logger.ts:51
Logs a normal, noteworthy event.
Parameters
Section titled “Parameters”message
Section titled “message”string
fields?
Section titled “fields?”Readonly<Record<string, unknown>>
Returns
Section titled “Returns”void
isEnabled()
Section titled “isEnabled()”isEnabled(
level):boolean
Defined in: app/src/kernel/logging/logger.ts:45
Parameters
Section titled “Parameters”A level.
Returns
Section titled “Returns”boolean
Whether records of that level are written.
trace()
Section titled “trace()”trace(
message,fields?):void
Defined in: app/src/kernel/logging/logger.ts:47
Logs very detailed diagnostics.
Parameters
Section titled “Parameters”message
Section titled “message”string
fields?
Section titled “fields?”Readonly<Record<string, unknown>>
Returns
Section titled “Returns”void
warn()
Section titled “warn()”warn(
message,fields?):void
Defined in: app/src/kernel/logging/logger.ts:53
Logs an unexpected condition that the browser recovered from.
Parameters
Section titled “Parameters”message
Section titled “message”string
fields?
Section titled “fields?”Readonly<Record<string, unknown>>
Returns
Section titled “Returns”void
LogRecord
Section titled “LogRecord”Defined in: app/src/kernel/logging/logger.ts:19
One log entry. Records stay on the device; nothing is ever uploaded.
Properties
Section titled “Properties”error?
Section titled “error?”
readonlyoptionalerror?:object
Defined in: app/src/kernel/logging/logger.ts:28
Name, message and stack of an error, if one was logged.
message
Section titled “message”
readonlymessage:string
readonlyname:string
stack?
Section titled “stack?”
readonlyoptionalstack?:string
fields?
Section titled “fields?”
readonlyoptionalfields?:Readonly<Record<string,unknown>>
Defined in: app/src/kernel/logging/logger.ts:26
readonlylevel:LogLevel
Defined in: app/src/kernel/logging/logger.ts:22
message
Section titled “message”
readonlymessage:string
Defined in: app/src/kernel/logging/logger.ts:25
readonlyscope:string
Defined in: app/src/kernel/logging/logger.ts:24
Dotted origin, such as kernel.modules or module.workspaces.
readonlytime:number
Defined in: app/src/kernel/logging/logger.ts:21
Wall time in milliseconds since the Unix epoch.
LogSink
Section titled “LogSink”Defined in: app/src/kernel/logging/logger.ts:32
Writes log records somewhere, for example to a rotating file or a memory buffer.
Methods
Section titled “Methods”write()
Section titled “write()”write(
record):void
Defined in: app/src/kernel/logging/logger.ts:37
Writes one record.
Parameters
Section titled “Parameters”record
Section titled “record”The record to write.
Returns
Section titled “Returns”void
SinkLoggerOptions
Section titled “SinkLoggerOptions”Defined in: app/src/kernel/logging/logger.ts:67
Options for a SinkLogger.
Properties
Section titled “Properties”level?
Section titled “level?”
readonlyoptionallevel?:LogLevel
Defined in: app/src/kernel/logging/logger.ts:70
Records below this level are dropped. Defaults to info.
readonlyscope:string
Defined in: app/src/kernel/logging/logger.ts:68
Type Aliases
Section titled “Type Aliases”LogFields
Section titled “LogFields”LogFields =
Readonly<Record<string,unknown>>
Defined in: app/src/kernel/logging/logger.ts:16
Structured context attached to a log record. Values must be JSON-serializable.
LogLevel
Section titled “LogLevel”LogLevel =
"trace"|"debug"|"info"|"warn"|"error"
Defined in: app/src/kernel/logging/logger.ts:5
Severity of a log record, from most to least verbose.
Variables
Section titled “Variables”LoggerToken
Section titled “LoggerToken”Defined in: app/src/kernel/logging/logger.ts:64
Token for the root Logger.
Functions
Section titled “Functions”describeError()
Section titled “describeError()”describeError(
error):object
Defined in: app/src/kernel/logging/logger.ts:149
Converts any thrown value into the serializable error shape of a LogRecord.
Parameters
Section titled “Parameters”unknown
A thrown value.
Returns
Section titled “Returns”object
message
Section titled “message”
readonlymessage:string
readonlyname:string
stack?
Section titled “stack?”
readonlyoptionalstack?:string