noderus@0.4.0 docs /Users/Nick/work/noderus documentation build index.js -f md --github
Sets up the default set of fields to be logged with every message. Call this before using the logger.
const { name, version } = require('./package.json')
setStandardFields(name, version)Forwards to console.log.
Combines the fields provided with the standard fields.
msgstring The message itselffieldsobject? The collection of additional fields to log with the message
Forwards to console.log.
Combines the fields provided with the standard fields.
msgstring The message itselffieldsobject? The collection of additional fields to log with the message
Forwards to console.warn.
Combines the fields provided with the standard fields.
msgstring The message itselffieldsobject? The collection of additional fields to log with the message
Forwards to console.error.
Combines the fields provided with the standard fields.
msgstring The message itselffieldsobject? The collection of additional fields to log with the message
Forwards to console.error.
Combines the fields provided with the standard fields.
NOTE: Also exits the process with a code of 1.
msgstring The message itselffieldsobject? The collection of additional fields to log with the message
Takes an object representing an HTTP request and a message. Creates a set of logging fields to extract certain data from the request and combines them with the standard fields. Logs at level INFO.
msgstring The message itselfreqobject A representation of an HTTP request, abstracted from any particular implentation.
// logging from koa
const request = {
header: ctx.request.header,
protocol: ctx.protocol,
remoteAddress: ctx.originalUrl,
url: ctx.url,
method: ctx.method,
contentLength: ctx.request.length
}
logRequest('HTTP request', request)Takes an object representing an HTTP response and a message. Creates a set of logging fields to extract certain data from the response and combines them with the standard fields. Logs at level INFO.
msgstring The message itselfresobject A representation of an HTTP response, abstracted from any particular implentation.
// logging from koa
const response = {
header: ctx.request.header,
protocol: ctx.protocol,
remoteAddress: ctx.originalUrl,
url: ctx.url,
method: ctx.method,
contentLength: ctx.response.length,
status: ctx.status
}
logResponse('HTTP response', response)