Static
loggerStatic
nestingStatic
defaultStatic
formatSet logFormatter using configuration-style format name.
the name of the formatter (see Format enum)
Static
levelSet log level using configuration-style level name for the default logger.
Static
logGet the log function for the default logger.
Set the log function for the default logger.
Static
logGet the log formatter for the default logger.
Set the log formatter for the default logger.
Static
logStatic
addAdd additional logger to the list of loggers including the default configuration.
Static
captureStatic
getStatic
getStatic
maskMask a string with a given character. If unmaskedLength is provided then these number of characters will be shown unmasked.
String to mask
Optional
maskChar: stringcharacter to mask with
Optional
unmaskedLength: numbernumber of characters to show unmasked in the beginning
Static
nestStatic
nestStatic
removeStatic
reportUnhandled error reporter.
Some environments do not report full error details such as Error#cause and AggregateError#errors.
To ensure these details are always recorded somewhere, unhandled errors may be reported here.
To disable this behavior replace this function.
Static
setSet default loglevel for the logger with the matching identifier.
The identifier of the logger
The level to set
Static
setStatic
setSet the log formatter for the logger with the matching identifier.
The identifier of the logger
The log formatter to set
Static
setStatic
setStatic
toJSON
Logger that can be used to emit traces.
The class supports adding multiple loggers for different targets. A default logger (identifier "default") is added on startup which logs to "console".
Usage:
const facility = Logger.get("loggerName"); facility.debug("My debug message", "my extra value to log");
The configuration of the default logger can be adjusted by using the static properties of the Logger class:
For additional loggers, use Logger.addLogger() to add a new logger with a specific identifier. Afterwards the configuration of these can be adjusted using static methods with the identifier as first parameter: