@ui5/logger/Logger

@ui5/logger/Logger

Standard logging module for UI5 Tooling and extensions.

Emits ui5.log events on the process object, which can be handled by dedicated writers, like @ui5/logger/writers/Console.

If no listener is attached to an event, messages are written directly to the process.stderr stream.

Constructor

new @ui5/logger/Logger(moduleName)

Source:
Parameters:
Name Type Description
moduleName string Identifier for messages created by this logger. Example: module:submodule:Class

Members

LOG_EVENT_NAME :string

Description:
  • Event name used for emitting new log-message event on the process object
Source:
Event name used for emitting new log-message event on the process object
Type:
  • string

LOG_LEVELS :Array.<string>

Description:
  • Available log levels, ordered by priority:
    1. silly
    2. verbose
    3. perf
    4. info (default)
    5. warn
    6. error
    7. silent
    Log level silent is special in the sense that no messages can be submitted with that level. It can be used to suppress all logging.
Source:
Available log levels, ordered by priority:
  1. silly
  2. verbose
  3. perf
  4. info (default)
  5. warn
  6. error
  7. silent
Log level silent is special in the sense that no messages can be submitted with that level. It can be used to suppress all logging.
Type:
  • Array.<string>

Methods

error(…message)

Description:
  • Create a log entry with the error level
Source:
Parameters:
Name Type Attributes Description
message any <repeatable>
Messages to log. An automatic string conversion is applied if necessary

info(…message)

Description:
  • Create a log entry with the info level
Source:
Parameters:
Name Type Attributes Description
message any <repeatable>
Messages to log. An automatic string conversion is applied if necessary

isLevelEnabled(levelName) → {boolean}

Description:
  • Tests whether the provided log level is enabled by the current log level
Source:
Parameters:
Name Type Description
levelName string Log level to test
Returns:
True if the provided level is enabled
Type
boolean

perf(…message)

Description:
  • Create a log entry with the perf level
Source:
Parameters:
Name Type Attributes Description
message any <repeatable>
Messages to log. An automatic string conversion is applied if necessary

silly(…message)

Description:
  • Create a log entry with the silly level
Source:
Parameters:
Name Type Attributes Description
message any <repeatable>
Messages to log. An automatic string conversion is applied if necessary

verbose(…message)

Description:
  • Create a log entry with the verbose level
Source:
Parameters:
Name Type Attributes Description
message any <repeatable>
Messages to log. An automatic string conversion is applied if necessary

warn(…message)

Description:
  • Create a log entry with the warn level
Source:
Parameters:
Name Type Attributes Description
message any <repeatable>
Messages to log. An automatic string conversion is applied if necessary

(static) getLevel() → {string}

Description:
  • Gets the current log level
Source:
Returns:
The current log level. Defaults to info
Type
string

(static) isLevelEnabled(levelName) → {boolean}

Description:
  • Tests whether the provided log level is enabled by the current log level
Source:
Parameters:
Name Type Description
levelName string Log level to test
Returns:
True if the provided level is enabled
Type
boolean

(static) setLevel(levelName)

Description:
  • Sets the standard log level.
    Example: Setting it to perf would suppress all silly and verbose logging, and only show perf, info, warn and error logs.
Source:
Parameters:
Name Type Description
levelName string New log level