The safeLogger logic exists because we allow the application to pass in a custom logger, but there is no guarantee that the logger works correctly and if it ever throws exceptions there could be serious consequences (e.g. an uncaught exception within an error event handler, due to the SDK trying to log the error, can terminate the application). An exception could result from faulty logic in the logger implementation, or it could be that this is not a logger at all but some other kind of object; the former is handled by a catch block that logs an error message to the SDK's default logger, and we can at least partly guard against the latter by checking for the presence of required methods at configuration time.

Hierarchy

  • SafeLogger

Implements

Constructors

Properties

Methods

Constructors

  • Construct a safe logger with the specified logger.

    Parameters

    • logger: LDLogger

      The logger to use.

    • fallback: LDLogger

      A fallback logger to use in case an issue is encountered using the provided logger.

    Returns SafeLogger

Properties

_fallback: any
_log: any
_logger: any

Methods

  • The debug logger.

    Parameters

    • Rest ...args: any[]

      A sequence of any JavaScript values.

      Rest

    Returns void

  • The error logger.

    Parameters

    • Rest ...args: any[]

      A sequence of any JavaScript values.

      Rest

    Returns void

  • The info logger.

    Parameters

    • Rest ...args: any[]

      A sequence of any JavaScript values.

      Rest

    Returns void

  • The warning logger.

    Parameters

    • Rest ...args: any[]

      A sequence of any JavaScript values.

      Rest

    Returns void

Generated using TypeDoc