The Logger class provides access to the methods for logging messages at the required Level.

Typically, each component or service will instantiate its own Logger instance, which will include the logger's Logger.name in the logged message.

Constructors

Properties

Methods

Constructors

  • Internal

    Instantiates a new Logger.

    Logger instances should NOT be instantiated directly using this constructor as the instance will not be registered and cached within the LogService. (This will mean that every instance of the parent class will end up with its own duplicate copy, rather than sharing a single instance.) Instead, use the LogService.getLogger() method, i.e.

       this._log = logService.getLogger('MyComponent');
    

    Parameters

    Returns Logger

Properties

name: string

A name, usually that of the 'parent' component, that will be logged with each message.

Methods

  • Logs the message if condition is false.

    The log entry is recorded as Level.error.

    Parameters

    • condition: undefined | boolean

      A boolean value or statement that determines if the message is logged or not.

    • message: string

      The text message to be logged.

    Returns void

  • Logs the message if condition is false.

    The log entry is recorded as Level.error.

    Parameters

    • condition: undefined | boolean

      A boolean value or statement that determines if the message is logged or not.

    • error: Error

      An Error object to be logged.

    Returns void

  • Logs the message if condition is false.

    The log entry is recorded as Level.error.

    Parameters

    • condition: undefined | boolean

      A boolean value or statement that determines if the message is logged or not.

    • message: string

      The text message to be logged.

    • error: Error

      An Error object to be logged.

    Returns void

  • Logs the message if condition is false.

    The log entry is recorded as Level.error.

    Parameters

    • condition: undefined | boolean

      A boolean value or statement that determines if the message is logged or not.

    • message: string
    • data: object

      An object to be logged.

    Returns void

  • Logs the message as Level.debug.

    Parameters

    • message: string

      The text message to be logged.

    Returns void

  • Logs the message as Level.debug.

    Parameters

    • error: Error

      An Error object to be logged.

    Returns void

  • Logs the message as Level.debug.

    Parameters

    • message: string

      The text message to be logged.

    • error: Error

      An Error object to be logged.

    Returns void

  • Logs the message as Level.debug.

    Parameters

    • message: string

      The text message to be logged.

    • data: object

      An object to be logged.

    Returns void

  • Logs the message as Level.error.

    Parameters

    • message: string

      The text message to be logged.

    Returns void

  • Logs the message as Level.error.

    Parameters

    • error: Error

      An Error object to be logged.

    Returns void

  • Logs the message as Level.error.

    Parameters

    • message: string

      The text message to be logged.

    • error: Error

      An Error object to be logged.

    Returns void

  • Logs the message as Level.error.

    Parameters

    • message: string

      The text message to be logged.

    • data: object

      An object to be logged.

    Returns void

  • Logs the message as Level.fatal.

    Parameters

    • message: string

      The text message to be logged.

    Returns void

  • Logs the message as Level.fatal.

    Parameters

    • error: Error

      An Error object to be logged.

    Returns void

  • Logs the message as Level.fatal.

    Parameters

    • message: string

      The text message to be logged.

    • error: Error

      An Error object to be logged.

    Returns void

  • Logs the message as Level.fatal.

    Parameters

    • message: string

      The text message to be logged.

    • data: object

      An object to be logged.

    Returns void

  • Logs the message as Level.info.

    Parameters

    • message: string

      The text message to be logged.

    Returns void

  • Logs the message as Level.info.

    Parameters

    • error: Error

      An Error object to be logged.

    Returns void

  • Logs the message as Level.info.

    Parameters

    • message: string

      The text message to be logged.

    • error: Error

      An Error object to be logged.

    Returns void

  • Logs the message as Level.info.

    Parameters

    • message: string

      The text message to be logged.

    • data: object

      An object to be logged.

    Returns void

  • Logs the message as the specified level.

    Parameters

    • levelName: string

      The name of the level.

    • message: string

      The text message to be logged.

      If no Level has been defined for the specified levelName, the message will be ignored.

    Returns void

  • Logs the message as the specified level.

    Parameters

    • levelName: string

      The name of the level.

    • error: Error

      An Error object to be logged.

      If no Level has been defined for the specified levelName, the message will be ignored.

    Returns void

  • Logs the message as the specified level.

    Parameters

    • levelName: string

      The name of the level.

    • message: string

      The text message to be logged.

    • error: Error

      An Error object to be logged.

      If no Level has been defined for the specified levelName, the message will be ignored.

    Returns void

  • Logs the message as the specified level.

    Parameters

    • levelName: string

      The name of the level.

    • message: string

      The text message to be logged.

    • data: object

      An object to be logged.

      If no Level has been defined for the specified levelName, the message will be ignored.

    Returns void

  • Logs the message as Level.warn.

    Parameters

    • message: string

      The text message to be logged.

    Returns void

  • Logs the message as Level.warn.

    Parameters

    • error: Error

      An Error object to be logged.

    Returns void

  • Logs the message as Level.warn.

    Parameters

    • message: string

      The text message to be logged.

    • error: Error

      An Error object to be logged.

    Returns void

  • Logs the message as Level.warn.

    Parameters

    • message: string

      The text message to be logged.

    • data: object

      An object to be logged.

    Returns void