Optional
options: BasicLoggerOptionsConfiguration for the logger. If no options are specified, the
logger uses { level: 'info' }
.
This example shows how to use basicLogger
in your SDK options to enable console
logging only at warn
and error
levels.
const ldOptions = {
logger: ld.basicLogger({ level: 'warn' }),
};
This example shows how to use basicLogger
in your SDK options to cause log
output to go to console.log
instead of console.error
.
const ldOptions = {
logger: ld.basicLogger({ destination: console.log }),
};
Provides a simple LDLogger implementation.
This logging implementation uses a simple format that includes only the log level and the message text. Output is written to the standard error stream (
console.error
). You can filter by log level as described in BasicLoggerOptions.level.To use the logger created by this function, put it into LDOptions.logger. If you do not set LDOptions.logger to anything, the SDK uses a default logger that is equivalent to
ld.basicLogger({ level: 'info' })
.