A singleton service that manages loggers registered in the application, and can be used to log output to all of them based on the configured logging level.

This should be used in place of console.log as it also supports logging to external locations.

Example

logging.info('Info level!')
logging.debug('Some debugging information...')
logging.warn('A warning!', true) // true, to force it to show, regardless of logging level.

Hierarchy

  • Logging

Constructors

Properties

currentLevel: LoggingLevel = LoggingLevel.Warning

The currently configured logging level.

registeredLoggers: Logger[] = []

Array of Logger implementations that should be logged to.

Accessors

Methods

  • Write a debugging-level output to the logs.

    Parameters

    • output: unknown
    • force: boolean = false

      if true, output even if outside the current logging level

    Returns void

  • Write an error-level output to the logs.

    Parameters

    • output: unknown
    • force: boolean = false

      if true, output even if outside the current logging level

    Returns void

  • Protected

    Get the name of the object that called the log method using error traces.

    Parameters

    • level: number = 5

    Returns string

  • Write an info-level output to the logs.

    Parameters

    • output: unknown
    • force: boolean = false

      if true, output even if outside the current logging level

    Returns void

  • Write a success-level output to the logs.

    Parameters

    • output: unknown
    • force: boolean = false

      if true, output even if outside the current logging level

    Returns void

  • Parameters

    • output: unknown
    • force: boolean = false

    Returns void

  • Write a verbose-level output to the logs.

    Parameters

    • output: unknown
    • force: boolean = false

      if true, output even if outside the current logging level

    Returns void

  • Write a warning-level output to the logs.

    Parameters

    • output: unknown
    • force: boolean = false

      if true, output even if outside the current logging level

    Returns void

  • Protected

    Helper function to write the given output, at the given logging level, to all of the registered loggers.

    Parameters

    • level: LoggingLevel
    • output: unknown
    • force: boolean = false

      if true, output even if outside the current logging level

    Returns void