StaticloggerStaticnestingStaticdefaultStaticformatSet logFormatter using configuration-style format name.
the name of the formatter (see Format enum)
StaticlevelSet log level using configuration-style level name for the default logger.
StaticlogGet the log function for the default logger.
Set the log function for the default logger.
StaticlogGet the log formatter for the default logger.
Set the log formatter for the default logger.
StaticlogStaticaddAdd additional logger to the list of loggers including the default configuration.
StaticcaptureStaticgetStaticgetStaticmaskMask a string with a given character. If unmaskedLength is provided then these number of characters will be shown unmasked.
String to mask
OptionalmaskChar: stringcharacter to mask with
OptionalunmaskedLength: numbernumber of characters to show unmasked in the beginning
StaticnestStaticnestStaticremoveStaticreportUnhandled 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.
StaticsetSet default loglevel for the logger with the matching identifier.
The identifier of the logger
The level to set
StaticsetStaticsetSet the log formatter for the logger with the matching identifier.
The identifier of the logger
The log formatter to set
StaticsetStaticsetStatictoJSON
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: