Members
_lastDelta :number
Last delta time in millisecond since app started. Used for log's time taken feature.
- number
- Source
app :App
The app instance.
- Source
Methods
debug(prefix, …params)
Display & format message in debug level. See formatMsg for details.
| Name | Type | Attributes | Description |
|---|---|---|---|
prefix | string | Message prefix | |
params | any | <repeatable> | Parameters |
- Source
(async) dispose() → {Promise.<void>}
Dispose internal references.
- Source
- Type:
- Promise.<void>
error(prefix, …params)
Display & format message in error level. See formatMsg for details.
| Name | Type | Attributes | Description |
|---|---|---|---|
prefix | string | Message prefix | |
params | any | <repeatable> | Parameters |
- Source
fatal(prefix, …params)
Display & format message in fatal level. See formatMsg for details.
| Name | Type | Attributes | Description |
|---|---|---|---|
prefix | string | Message prefix | |
params | any | <repeatable> | Parameters |
- Source
formatMsg(level, prefix, …params)
Display & format message according to one of these rules:
levelprefixtextvar 1var 2...var n- Translatetextand interpolate withvarsfor levellevellevelprefixdatatextvar 1var 2...var n- As above, and append stringifieddatalevelprefixerror- Format as Err object. If current log level is trace, dump it on screen
In prod environment, log will be delivered as JSON stringified object. See Log.TJsonOutput for more info
| Name | Type | Attributes | Description |
|---|---|---|---|
level | string | Log level to use | |
prefix | string | Prefix to the message | |
params | any | <repeatable> | See format above |
- Source
getErrorMessage(error) → {string}
Get error message from an Error object. If the message is empty, return the code or statusCode instead.
| Name | Type | Description |
|---|---|---|
error | Error | Error object |
- Source
Error message
- Type:
- string
getRotationPattern(isPrev) → {string}
Calculate pattern used for log rotation. Used by save method to determine the log file name.
| Name | Type | Description |
|---|---|---|
isPrev | boolean | If |
- Source
Calculated pattern
- Type:
- string
info(prefix, …params)
Display & format message in info level. See formatMsg for details.
| Name | Type | Attributes | Description |
|---|---|---|---|
prefix | string | Message prefix | |
params | any | <repeatable> | Parameters |
- Source
save(text, prefixopt)
Save log to file in {dataDir}/log.
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
text | string | Log message to save | ||
prefix | string | <optional> | 'bajo' | Use prefix as basename. Defaults to |
- Source
silent(prefix, …params)
Display & format message in silent level. See formatMsg for details.
| Name | Type | Attributes | Description |
|---|---|---|---|
prefix | string | Message prefix | |
params | any | <repeatable> | Parameters |
- Source
trace(prefix, …params)
Display & format message in trace level. See formatMsg for details.
| Name | Type | Attributes | Description |
|---|---|---|---|
prefix | string | Message prefix | |
params | any | <repeatable> | Parameters |
- Source
warn(prefix, …params)
Display & format message in warn level. See formatMsg for details.
| Name | Type | Attributes | Description |
|---|---|---|---|
prefix | string | Message prefix | |
params | any | <repeatable> | Parameters |
- Source
Type Definitions
TJsonOutput
Log output in stringified JSON format. Returned when app run in prod environment.
| Name | Type | Attributes | Description |
|---|---|---|---|
prefix | string | Message prefix. | |
message | string | The message itself. | |
level | string | Log level. | |
time | number | Time in millisecond. | |
pid | number | Process ID. | |
hostname | string | Hostname. | |
data | Object | <optional> | Payload data, if any. |
- Source
TLevels
- Object
| Name | Type | Description | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
trace | Object | Properties
| |||||||||||||||
debug | Object | Properties
| |||||||||||||||
info | Object | Properties
| |||||||||||||||
warn | Object | Properties
| |||||||||||||||
error | Object | Properties
| |||||||||||||||
fatal | Object | Properties
| |||||||||||||||
silent | Object | Properties
|
- Source