Logger
Implements
Index
Constructors
publicconstructor
Properties
publicoptionalcontext
publicoptionallabels
The labels for this logger instance.
publicoptionallogLevel
The minimum severity level to log for this logger instance.
publicstaticoptionalcontext
The default context for loggers.
publicstaticinstance
The default logger instance.
publicstaticoptionallabels
The default labels for loggers.
publicstaticlogLevel
The minimum severity level to log.
publicstaticwriter
The writer to use for logging.
Accessors
public[toStringTag]
A string tag that identifies this object as a logger.
Returns string
Methods
publicalert
A person must take an action immediately.
Example:
Logger.alert('An error occurred.', { status: 500, error: new Error('Something went wrong.') });
Parameters
message: string
The log message.
optionalpayload: LogPayload
A map of key-value pairs that provides additional data to be logged.
Returns void
publiccritical
Critical events cause more severe problems or outages.
Example:
Logger.critical('An error occurred.', { status: 500, error: new Error('Something went wrong.') });
Parameters
message: string
The log message.
optionalpayload: LogPayload
A map of key-value pairs that provides additional data to be logged.
Returns void
publicdebug
Debug or trace information.
Example:
Logger.debug('The server is running.');
Logger.debug('The server is running.', { port: 3000 });Parameters
message: string
The log message.
optionalpayload: LogPayload
A map of key-value pairs that provides additional data to be logged.
Returns void
publicdefault
The log entry has no assigned severity level.
Example:
Logger.default('The server is running.');
Logger.default('The server is running.', { port: 3000 });Parameters
message: string
The log message.
optionalpayload: LogPayload
A map of key-value pairs that provides additional data to be logged.
Returns void
publicemergency
One or more systems are unusable.
Example:
Logger.emergency('An error occurred.', { status: 500, error: new Error('Something went wrong.') });
Parameters
message: string
The log message.
optionalpayload: LogPayload
A map of key-value pairs that provides additional data to be logged.
Returns void
publicerror
Error events are likely to cause problems.
Example:
Logger.error('An error occurred.', { status: 500, error: new Error('Something went wrong.') });
Parameters
message: string
The log message.
optionalpayload: LogPayload
A map of key-value pairs that provides additional data to be logged.
Returns void
publicinfo
Routine information, such as ongoing status or performance.
Example:
Logger.info('The server is running.');
Logger.info('The server is running.', { port: 3000 });Parameters
message: string
The log message.
optionalpayload: LogPayload
A map of key-value pairs that provides additional data to be logged.
Returns void
publicnotice
Normal but significant events, such as start up, shut down, or a configuration change.
Example:
Logger.notice('The server is running.');
Logger.notice('The server is running.', { port: 3000 });Parameters
message: string
The log message.
optionalpayload: LogPayload
A map of key-value pairs that provides additional data to be logged.
Returns void
publicwarning
Warning events might cause problems.
Example:
Logger.warning('Unauthorized access.', { status: 401 });
Parameters
message: string
The log message.
optionalpayload: LogPayload
A map of key-value pairs that provides additional data to be logged.
Returns void
publicstaticalert
A person must take an action immediately.
Example:
Logger.alert('An error occurred.', { status: 500, error: new Error('Something went wrong.') });
Parameters
message: string
The log message.
optionalpayload: LogPayload
A map of key-value pairs that provides additional data to be logged.
Returns void
publicstaticcritical
Critical events cause more severe problems or outages.
Example:
Logger.critical('An error occurred.', { status: 500, error: new Error('Something went wrong.') });
Parameters
message: string
The log message.
optionalpayload: LogPayload
A map of key-value pairs that provides additional data to be logged.
Returns void
publicstaticdebug
Debug or trace information.
Example:
Logger.debug('The server is running.');
Logger.debug('The server is running.', { port: 3000 });Parameters
message: string
The log message.
optionalpayload: LogPayload
A map of key-value pairs that provides additional data to be logged.
Returns void
publicstaticdefault
The log entry has no assigned severity level.
Example:
Logger.default('The server is running.');
Logger.default('The server is running.', { port: 3000 });Parameters
message: string
The log message.
optionalpayload: LogPayload
A map of key-value pairs that provides additional data to be logged.
Returns void
publicstaticemergency
One or more systems are unusable.
Example:
Logger.emergency('An error occurred.', { status: 500, error: new Error('Something went wrong.') });
Parameters
message: string
The log message.
optionalpayload: LogPayload
A map of key-value pairs that provides additional data to be logged.
Returns void
publicstaticerror
Error events are likely to cause problems.
Example:
Logger.error('An error occurred.', { status: 500, error: new Error('Something went wrong.') });
Parameters
message: string
The log message.
optionalpayload: LogPayload
A map of key-value pairs that provides additional data to be logged.
Returns void
publicstaticinfo
Routine information, such as ongoing status or performance.
Example:
Logger.info('The server is running.');
Logger.info('The server is running.', { port: 3000 });Parameters
message: string
The log message.
optionalpayload: LogPayload
A map of key-value pairs that provides additional data to be logged.
Returns void
publicstaticnotice
Normal but significant events, such as start up, shut down, or a configuration change.
Example:
Logger.notice('The server is running.');
Logger.notice('The server is running.', { port: 3000 });Parameters
message: string
The log message.
optionalpayload: LogPayload
A map of key-value pairs that provides additional data to be logged.
Returns void
publicstaticwarning
Warning events might cause problems.
Example:
Logger.warning('Unauthorized access.', { status: 401 });
Parameters
message: string
The log message.
optionalpayload: LogPayload
A map of key-value pairs that provides additional data to be logged.
Returns void
The context for this logger instance.