Debug HTTP printer for pino
- express-pino-logger
- restify-pino-logger
- koa-pino-logger
- pino-http
- hapi-pino (via CLI only)
const printerFactory = require('pino-http-print')
const printer = printerFactory()
var logger = require('pino-http')(printer)const printerFactory = require('pino-http-print')
const printer = printerFactory()
const logger = require('express-pino-logger')(printer)Same for koa-pino-logger and restify-pino-logger,
just pass in the printer stream.
[1574071926285] GET http://localhost:20000/api/activity/component 200\nReturns a new printer.
The common options between this and pino-pretty options are set from the first object itself. pinoPrettyOptions is forwarded to pino-pretty for non-http logs (when all is true).
See the Options section for all possible options.
Returns a stream that will pull off
Options argument for printerFactory with keys corresponding to the options described in CLI Arguments:
{
colorize: chalk.supportsColor, // --colorize
all: false, // --all
translateTime: false, // --translateTime
relativeUrl: false, // --relativeUrl
lax: false // --lax
}The colorize default follows
chalk.supportsColor.
npm install -g pino-http-printSpin up server that uses a pino http logger and pipe it to pino-http-print
node server | pino-http-print-all(-a): Causespino-http-printto also print non-HTTP log messages by passing them through topino-pretty.--colorize(-c): Adds terminal color escape sequences to the output.--translateTime(-t): Translate the epoch time value into a human readable date and time string. This flag also can set the format string to apply when translating the date to human readable format. This is the same aspino-prettytranslateTime- The default format is
yyyy-mm-dd HH:MM:ss.l oin UTC.
- The default format is
--relativeUrl(-r): print only the relative url
MIT
- Sponsored by nearForm