Class: Level

logging.Level(name, value)

Define a set of standard logging levels that can be used to control logging output.

Constructor

new Level(name, value)

Initializes a new level and registers it.

Parameters:
Name Type Description
name string

The name of the level.

value number

The value of the level.

Members

ALL :Level

ALL indicates that all messages should be logged.

Type:
  • Level

DEBUG :Level

DEBUG is a message level providing tracing information.

Type:
  • Level

ERROR :Level

ERROR is a message level indicating a serious failure.

Type:
  • Level

INFO :Level

INFO is a message level for informational messages.

Type:
  • Level

OFF :Level

OFF is a special level that can be used to turn off logging.

Type:
  • Level

TRACE :Level

TRACE is a message level providing fine-grained tracing information.

Type:
  • Level

WARNING :Level

WARNING is a message level indicating a potential problem.

Type:
  • Level

name :string

The name of the level.

Type:
  • string

value :number

The value of the level.

Type:
  • number

Methods

toJSON() → {string}

Returns the name of the level.

Returns:

The name of the level.

Type
string

toString() → {string}

Returns a string representation of the level.

Returns:

The name of the level.

Type
string

valueOf() → {number}

Returns the value of the level.

Returns:

The value of the level.

Type
number

(static) parse(name)

Parses a level string or number into a Level.

For example:

  • "ERROR"
  • "1000"
Parameters:
Name Type Description
name string | number

The name or value of the level.

Returns:

The parsed value.