Class: LogManager

LogManager

Exposes a simple API for managing logs output by the Webcom SDK.

Javascript objects that have a logger output logs with the following format:

YYYY-MM-DDThh:mm:ss.sssZ <name> [#<id>] <message>

  • The timestamp may be shown or hidden using LogManager.showTimestamp and LogManager.hideTimestamp methods (hidden by default),
  • <name> is replaced with the actual logger name and displayed with a fixed width that can be set using the LogManager.setPrefixWidth method (15 by default),
  • <id> is replaced with the identifier of the logger and displayed with a fixed width of 3 digits. This field is useful to distinguish between loggers of various instances of the same class.

This static class is intended to be accessed using the Webcom.Log static property.

Since:
  • 2.11

Members

(static, readonly) ERROR

This log level logs only errors.

(static, readonly) INFO

This log level logs everything except logs for debug. This is the default level.

(static) level

Gets the current log level as a number.

(static) level

Sets the current log level. Use one of the LOG, INFO, WARN, ERROR or NONE constants.

(static, readonly) LOG

This log level logs everything, including logs for debug.

(static, readonly) NONE

This log level logs nothing at all.

(static, readonly) WARN

This log level logs only errors and warnings.

Methods

(static) disable(prefixopt)

Disables all loggers whose fully qualified name starts with a given prefix.

Parameters:
Name Type Attributes Description
prefix string <optional>

The logger prefix to disable

(static) enable(prefixopt)

Enables all loggers whose fully qualified name starts with a given prefix.

At first use, this method also disables all other loggers.

Parameters:
Name Type Attributes Description
prefix string <optional>

The logger prefix to enable

(static) hideDeprecations()

Only available with backward compatible Webcom libraries.
Filters out deprecation warning logs.

Since:
  • 3.0

(static) hideTimestamp()

Prevents all loggers from prefixing their outputs with a timestamp.

(static) setPrefixWidth(width)

Sets the prefix width (not including the timestamp if shown) of the outputs produced by the loggers.

Parameters:
Name Type Description
width number

The width for displaying logger names

(static) showDeprecations()

Only available with backward compatible Webcom libraries.
Makes deprecation warning logs visible.

Since:
  • 3.0

(static) showTimestamp()

Makes all loggers prefix their outputs with a timestamp.

show
deprecated