Configuration for basicLogger.

interface BasicLoggerOptions {
    destination?: ((line) => void);
    level?: LDLogLevel;
    prefix?: string;
}

Properties

destination?: ((line) => void)

An optional function to use to print each log line.

If this is specified, basicLogger calls it to write each line of output. The argument is a fully formatted log line, not including a linefeed. The function is only called for log levels that are enabled.

If not specified, the default in browsers is to use console.log, console.info, console.warn, or console.error according to the level; the default in Node.js and Electron is to always use console.log.

Setting this property to anything other than a function will cause SDK initialization to fail.

Type declaration

    • (line): void
    • Parameters

      • line: string

      Returns void

level?: LDLogLevel

The lowest level of log message to enable.

See LDLogLevel for a list of possible levels. Setting a level here causes all lower-importance levels to be disabled: for instance, if you specify 'warn', then 'debug' and 'info' are disabled.

If not specified, the default is 'info' (meaning that 'debug' is disabled).

prefix?: string

A string to prepend to all log output. If not specified, the default is "[LaunchDarkly] ".