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

Static Optional Readonly customLogCallback

customLogCallback?: CustomLogCallback

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

Static Optional Readonly logFile

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

Static emojiLogLevelHeadingsEnabled

  • 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

Static enabled

  • 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

Static minimumLogLevel

  • 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

Static debug

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

    Parameters

    • message: string

    Returns void

Static error

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

    Parameters

    • message: string

    Returns void

Static info

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

    Parameters

    • message: string

    Returns void

Static log

  • log(level: LogLevel, message: string): void

Static setCustomLogCallback

  • 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>

Static setLogFile

  • 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

Static setLogFileURL

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

    Parameters

    • url: URL

    Returns void

Static shared

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

    deprecated,

    use the Logger directly instead.

    Returns any

Static verbose

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

    Parameters

    • message: string

    Returns void

Static warning

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

    Parameters

    • message: string

    Returns void