Function
Static Public Summary | ||
public |
WinstonFormatter(objectPattern: {"message": *, "level": *, "meta": *, "timestamp": *}): * |
|
public |
Attaches a transport stream to a writeable stream. |
|
public |
expressMiddleware(options: object): * The express middleware takes care of automatically logging each http event with the appropriate context events attached. |
|
public |
install(transport: Stream) Installs the timber logger to route all stdout logs to the provided stream |
|
public |
log(args: ...*): * |
|
public |
stripMetadata(log: *) |
Static Public
public WinstonFormatter(objectPattern: {"message": *, "level": *, "meta": *, "timestamp": *}): * source
import WinstonFormatter from 'timber/src/formatters/winston.js'
Params:
Name | Type | Attribute | Description |
objectPattern | {"message": *, "level": *, "meta": *, "timestamp": *} |
|
Return:
* |
public attach(transports: Array, toStream: Writable, options: Object): {"detach": *} source
import attach from 'timber/src/utils/attach.js'
Attaches a transport stream to a writeable stream.
Return:
{"detach": *} |
public expressMiddleware(options: object): * source
import expressMiddleware from 'timber/src/middlewares/express.js'
The express middleware takes care of automatically logging each http event with the appropriate context events attached.
This middleware is composed of three separate middlewares:
addRequestId
automatically attaches a unique uuid to every requestbodyParser
allows parsing of JSON encoded request bodiesexpressMiddleware
automatically logs http events to timber
Params:
Name | Type | Attribute | Description |
options | object |
|
An object with configuration options |
options.logger | object |
|
A custom logger to log http events to (usually either: console, winston, or bunyan) |
options.capture_request_body | boolean |
|
Whether the http request body data will be captured (off by default) |
options.combine_http_events | boolean |
|
If true, HTTPRequest and HTTPResponse events will be combined in a single log message (off by defaut) |
Return:
* |
public install(transport: Stream) source
import install from 'timber/src/install.js'
Installs the timber logger to route all stdout logs to the provided stream
Params:
Name | Type | Attribute | Description |
transport | Stream | the stream that all logs will go through |
public log(args: ...*): * source
import log from 'timber/src/log.js'
Params:
Name | Type | Attribute | Description |
args | ...* |
Return:
* |
public stripMetadata(log: *) source
import {stripMetadata} from 'timber/src/utils/metadata.js'
Params:
Name | Type | Attribute | Description |
log | * |