Class with static methods to customize the logging behavior from Ditto and log messages with the Ditto logging infrastructure.

Hierarchy

  • Logger

Accessors

  • get emojiLogLevelHeadingsEnabled(): boolean
  • Represents whether or not emojis should be used as the log level indicator in the logs.

    Returns boolean

  • set emojiLogLevelHeadingsEnabled(emojiLogLevelHeadingsEnabled): void
  • Represents whether or not emojis should be used as the log level indicator in the logs.

    Parameters

    • emojiLogLevelHeadingsEnabled: boolean

    Returns void

  • get enabled(): boolean
  • Whether the logger is currently enabled.

    Returns boolean

  • set enabled(enabled): void
  • Enables or disables logging.

    Parameters

    • enabled: boolean

    Returns void

  • get logFile(): string
  • Registers a file path where logs will be written to, whenever Ditto wants to issue a log (on top of emitting the log to the console).

    Returns string

  • get minimumLogLevel(): LogLevel
  • The minimum log level at which logs will be logged.

    For example if this is set to Warning, then only logs that are logged with the Warning or Error log levels will be shown.

    Returns LogLevel

  • set minimumLogLevel(minimumLogLevel): void
  • The minimum log level at which logs will be logged.

    For example if this is set to Warning, then only logs that are logged with the Warning or Error log levels will be shown.

    Parameters

    Returns void

Methods

  • Convenience method, same as calling log() with LogLevel Debug.

    Parameters

    • message: string

    Returns void

  • Convenience method, same as calling log() with LogLevel Error.

    Parameters

    • message: string

    Returns void

  • Convenience method, same as calling log() with LogLevel Info.

    Parameters

    • message: string

    Returns void

  • Registers a custom callback that will be called to report each log entry.

    Parameters

    • callback: CustomLogCallback

      function called for each log entry. undefined will unregister any previous callback and stop reporting log entries through callbacks.

    Returns Promise<void>

    Throws

    if called in a React Native environment.

  • On Node, registers a file path where logs will be written to, whenever Ditto wants to issue a log (on top of emitting the log to the console). In the browser, this method has no effect.

    Parameters

    • path: string

      can be null, in which case the current logging file, if any, is unregistered, otherwise, the file path must be within an already existing directory.

    Returns void

  • Convenience method, takes the path part of the URL and calls setLogFile() with it.

    Parameters

    • url: URL

    Returns void

  • Convenience method, same as calling log() with LogLevel Verbose.

    Parameters

    • message: string

    Returns void

  • Convenience method, same as calling log() with LogLevel Warning.

    Parameters

    • message: string

    Returns void