Class: Logger

logger/Logger~Logger(optsopt)

new Logger(optsopt)

Multi-purpose logger.

Multi-purpose logger. Supports different kinds of logging (errors, warnings, fatal errors, etc.) and a variety of logging data (errors, strings, objects).

Parameters:
Name Type Attributes Description
opts Object <optional>

Logger options (not used by superclass).

Source:

Methods

_defaultBackend(logData) → {Promise}

Optional default backend.

Optional default backend.

Parameters:
Name Type Description
logData LogData
Source:
Returns:

Promise which is fulfilled when logging is complete.

Type
Promise

_defaultTracerBackend(logData) → {Promise}

Optional default tracing and debugging backend.

Optional default tracing and debugging backend.

Parameters:
Name Type Description
logData LogData
Source:
Returns:

Promise which is fulfilled when logging is complete.

Type
Promise

_getApplicableBackends(logData) → {Generator.<backendCallback>}

Gets all registered backends that apply to a particular logType.

Gets all registered backends that apply to a particular logType.

Parameters:
Name Type Description
logData LogData
Source:
Returns:
Type
Generator.<backendCallback>

_routeToBackends(logData) → {Promise|undefined}

Routes log data to backends.

Routes log data to backends. If logData.logType is fatal, exits process after logging to all backends.

Parameters:
Name Type Description
logData LogData
Source:
Returns:

A Promise that is fulfilled when all logging is complete, or undefined if no backend was applicable and the logType was not fatal (fast path common case).

Type
Promise | undefined

getDefaultBackend() → {backendCallback}

...
Source:
Returns:
Type
backendCallback

getDefaultTracerBackend() → {backendCallback}

...
Source:
Returns:
Type
backendCallback

log(logType) → {undefined|Promise}

Outputs logging and tracing information to different backends.

Outputs logging and tracing information to different backends.

Parameters:
Name Type Description
logType string
Source:
Returns:

a Promise that will be fulfilled when all logging is complete; for efficiency undefined is returned if this logType is being ignored (the common case).

Type
undefined | Promise

registerBackend(logType, backend)

Registers a backend by adding it to the collection of backends.

Registers a backend by adding it to the collection of backends.

Parameters:
Name Type Description
logType RegExp
backend backendCallback

Backend to send logging / tracing info to.

Source:

registerSampling(logType, percent)

Register sampling rates, in percent, for log types.

Register sampling rates, in percent, for log types.

Parameters:
Name Type Description
logType RegExp
percent number
Source: