Class Logger

Console logger as default fallback.

This logger uses the console.log method and simply prepends a timestamp plus the used log level in uppercase. You can write your own custom logger or pass any other (e.g. ioBroker has a suitable logger on board), that matches the ILogger interface.

Implements

Constructors

Accessors

Methods

Constructors

  • Initialize a new Logger.

    Parameters

    • OptionallogLevel: LogLevel

      Optionally define a custom log level. Default is LogLevel.INFO.

    Returns Logger

Accessors

  • get timestamp(): string
  • Get current datetime with milliseconds.

    Returns string

    An ISO 8601 conform timestamp (e.g. 2020-10-10T12:34:56.789Z).

Methods

  • ILogger a message with severity debug to console.

    Parameters

    • message: string

      The debug message.

    Returns void

  • ILogger a message with severity error to console.

    Parameters

    • message: string

      The error message.

    Returns void

  • ILogger a message with severity info.

    Parameters

    • message: string

      The information.

    Returns void

  • Set the actual log level

    Method calls to lower log levels than the one defined here, will not generate any output.

    Parameters

    Returns void

  • ILogger a message with severity warn to console.

    Parameters

    • message: string

      The warning.

    Returns void