Options
All
  • Public
  • Public/Protected
  • All
Menu

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

Hierarchy

  • Logger

Index

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
  • set emojiLogLevelHeadingsEnabled(emojiLogLevelHeadingsEnabled: boolean): void
  • Represents whether or not emojis should be used as the log level indicator in the logs.

    Returns boolean

  • Represents whether or not emojis should be used as the log level indicator in the logs.

    Parameters

    • emojiLogLevelHeadingsEnabled: boolean

    Returns void

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

    Returns boolean

  • Enables or disables logging.

    Parameters

    • enabled: boolean

    Returns void

  • get minimumLogLevel(): 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.

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

    Parameters

    Returns void

Methods

  • debug(message: string): void
  • Convenience method, same as calling log() with LogLevel Debug.

    Parameters

    • message: string

    Returns void

  • error(message: string): void
  • Convenience method, same as calling log() with LogLevel Error.

    Parameters

    • message: string

    Returns void

  • info(message: string): void
  • Convenience method, same as calling log() with LogLevel Info.

    Parameters

    • message: string

    Returns void

  • log(level: LogLevel, message: string): 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>

  • setLogFile(path: string): 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

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

    Parameters

    • url: URL

    Returns void

  • shared(): any
  • Returns the shared Logger instance.

    deprecated,

    use the Logger directly instead.

    Returns any

  • verbose(message: string): void
  • Convenience method, same as calling log() with LogLevel Verbose.

    Parameters

    • message: string

    Returns void

  • warning(message: string): void
  • Convenience method, same as calling log() with LogLevel Warning.

    Parameters

    • message: string

    Returns void