Protected
innerReadonly
namePrivate
uniqueProtected
Optional
[afterProtected
Optional
[beforeProtected
Optional
[errorReturns a new logger that wraps the current logger and filters out duplicate log messages.
A new DistinctLogger
instance.
Write a log entry to the log, this will be filtered by the log level and optional filters that are set.
Messages are formatted using the following rules:
%s
String%i
Integer (no decimals)%d
Decimal with 2 decimals%d:<X>
Decimal with X decimals%S
String in uppercase%<any other character>
The character will be ignoredLog level of the entry to write
Rest
...args: any[]Arguments to write to the log entr. If a single argument is passed it will be used as the message, otherwise the first argument will be used as a format string and the remaining arguments will be used as format arguments
logger.write(LogLevel.info, 'Hello', 'world'); // Hello world this is great
logger.write(LogLevel.info, 'Hello %s', 'world'); // Hello world
logger.write(LogLevel.info, 'Hello %S', 'world'); // Hello WORLD
logger.write(LogLevel.info, 'Hello %d', 1.234); // Hello 1.23
logger.write(LogLevel.info, 'Hello %d:3', 1.234); // Hello 1.234
logger.write(LogLevel.info, 'Hello %i', 1.234); // Hello 1
logger.write(LogLevel.info, 'Hello %i', 1234); // Hello 1234
logger.write(LogLevel.info, 'Hello %s', { foo: 'bar' }); // Hello {"foo":"bar"}
logger.write(LogLevel.info, 'Hello %s', () => 'world'); // Hello world
logger.write(LogLevel.info, 'Hello %s', 'world', 'this', 'is', 'great'); // Hello world this is great
logger.write(LogLevel.info, 'Hello', 'world %s %s %s', 'this', 'is', 'great'); // Hello world this is great
See
write