A log level.

Constructors

Properties

Methods

Constructors

  • Constructs a new log level.

    Parameters

    • label: string

      Level label.

    • value: number

      Level value. Must be >= zero.

    • Optional style: string

      Label CSS style. Defaults to "font-weight:bold;".

    • Optional logFn: ((...data) => void)

      Logging function. Defaults to console.log.

        • (...data): void
        • Parameters

          • Rest ...data: unknown[]

          Returns void

    Returns LogLevel

Properties

label: string

Level label.

logFn?: ((...data) => void)

Logging function. Defaults to console.log.

Type declaration

    • (...data): void
    • Logging function. Defaults to console.log.

      Parameters

      • Rest ...data: unknown[]

      Returns void

style?: string

Label CSS style. Defaults to "font-weight:bold;".

value: number

Level value. Must be >= zero.

ALL: LogLevel = ...

Log always. Its value is 0.

DEBUG: LogLevel = ...

Log at debugging level. Its value is 100.

ERROR: LogLevel = ...

Log at error level. Its value is 400.

INFO: LogLevel = ...

Log at information level. Its value is 200.

OFF: LogLevel = ...

Disables logging.

WARN: LogLevel = ...

Log at warning level. Its value is 300.

Methods

  • Gets the log level for the given level label.

    Parameters

    • labelOrLevel: string | LogLevel

      The level label "OFF", "ALL", "DEBUG", "INFO", "WARN", or "ERROR", or a level instance.

    Returns undefined | LogLevel

    The log label or undefined if no such level exists.

  • Gets the log level for the given log label.

    Parameters

    • labelOrLevel: string | LogLevel

      The level label "OFF", "ALL", "DEBUG", "INFO", "WARN", or "ERROR", or a level instance.

    • defaultLevel: LogLevel

      The default level. Ignored, if labelOrLevel is a valid label or level instance.

    Returns LogLevel

    The log label or the given defaultLevel if no such level exists.

Generated using TypeDoc