@launchdarkly/js-client-sdk - v4.14.1
    Preparing search index...

    Function basicLogger

    • Provides a basic LDLogger implementation.

      This logging implementation uses a basic format that includes only the log level and the message text. By default this uses log level 'info' and the output is written to console.error.

      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 will log "info" level and higher priorty messages and it will log messages to console.info, console.warn, and console.error.

      Parameters

      • options: BasicLoggerOptions

        Configuration for the logger. If no options are specified, the logger uses { level: 'info' }.

      Returns LDLogger

      This example shows how to use basicLogger in your SDK options to enable console logging only at warn and error levels.

        const ldOptions = {
      logger: basicLogger({ level: 'warn' }),
      };

      This example shows how to use basicLogger in your SDK options to cause all log output to go to console.log

        const ldOptions = {
      logger: basicLogger({ destination: console.log }),
      };

      The configuration also allows you to control the destination for each log level.

        const ldOptions = {
      logger: basicLogger({
      destination: {
      debug: console.debug,
      info: console.info,
      warn: console.warn,
      error:console.error
      }
      }),
      };