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

Hierarchy

  • Logger

Properties

customLogCallback?: CustomLogCallback

Returns the current custom log callback, undefined by default. See setCustomLogCallback() for a detailed description.

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).

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: boolean): 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: boolean): void
  • Enables or disables logging.

    Parameters

    • enabled: boolean

    Returns void

  • 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: LogLevel): 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>

  • 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