new Logger(optsopt)
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}
_defaultTracerBackend(logData) → {Promise}
_getApplicableBackends(logData) → {Generator.<backendCallback>}
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. 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}
getDefaultTracerBackend() → {backendCallback}
log(logType) → {undefined
|Promise}
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.
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.
Parameters:
Name | Type | Description |
---|---|---|
logType |
RegExp | |
percent |
number |
- Source: