pino-pretty
Prettifier for Pino log lines
Last updated 9 years ago by jsumners .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install pino-pretty 
SYNC missed versions from official npm registry.

pino-pretty

Build Status Coverage Status

This module provides a basic log prettifier for the Pino logging library. It reads a standard Pino log line like:

{"level":30,"time":1522431328992,"msg":"hello world","pid":42,"hostname":"foo","v":1}

And formats it to:

[1522431328992] INFO (42 on foo): hello world

Example

Using the example script from the Pino module, and specifying that logs should be colored and the time translated, we can see what the prettified logs will look like:

demo

Install

$ npm install -g pino-pretty

CLI Arguments

  • --colorize (-c): Adds terminal color escape sequences to the output.
  • --crlf (-f): Appends carriage return and line feed, instead of just a line feed, to the formatted log line.
  • --errorProps (-e): When formatting an error object, display this list of properties. The list should be a comma separated list of properties Default: ''.
  • --levelFirst (-l): Display the log level name before the logged date and time.
  • --errorLikeObjectKeys (-k): Define the log keys that are associated with error like objects. Default: err,error.
  • --messageKey (-m): Define the key that contains the main log message. Default: msg.
  • --translateTime (-t): Translate the epoch time value into a human readable date and time string in UTC. The default pattern is 'yyyy-mm-dd HH:MM:ss.l o'. If you want to translate to the local system's timezone, then you must prefix the format string with SYS:, e.g. 'SYS:yyyy-mm-dd HH:MM:ss'. See dateformat documentation for more available pattern letters.
  • --search (-s): Specifiy a search pattern according to jmespath.

API

pino-pretty exports a factory function that can be used to format log strings. It accepts an options argument with keys corresponding to the options described in CLI Arguments:

{
  colorize: false, // --colorize
  crlf: false, // --crlf
  errorLikeObjectKeys: ['err', 'error'], // --errorLikeObjectKeys
  errorProps: '', // --errorProps
  levelFirst: false, // --levelFirst
  messageKey: 'msg', // --messageKey
  translateTime: false, // --translateTime
  search: 'foo == `bar`' // --search
}

See the Pino's prettifier documentation for information on how to use this directly with pino.

License

MIT License

Current Tags

  • 13.2.0                                ...           latest (2 months ago)
  • 3.0.0-rc.2                                ...           next (8 years ago)

97 Versions

  • 13.2.0                                ...           2 months ago
  • 13.1.3                                ...           a year ago
  • 13.1.2                                ...           a year ago
  • 13.1.1                                ...           a year ago
  • 13.1.0                                ...           a year ago
  • 11.3.0                                ...           2 years ago
  • 13.0.0                                ...           2 years ago
  • 12.1.0                                ...           2 years ago
  • 12.0.0                                ...           2 years ago
  • 11.2.2                                ...           2 years ago
  • 11.2.1                                ...           2 years ago
  • 11.2.0                                ...           2 years ago
  • 11.1.0                                ...           3 years ago
  • 11.0.0                                ...           3 years ago
  • 10.3.1                                ...           3 years ago
  • 10.3.0                                ...           3 years ago
  • 10.2.3                                ...           3 years ago
  • 10.2.2                                ...           3 years ago
  • 10.2.1                                ...           3 years ago
  • 10.2.0                                ...           3 years ago
  • 10.1.0                                ...           3 years ago
  • 10.0.1                                ...           3 years ago
  • 9.4.1                                ...           3 years ago
  • 10.0.0                                ...           4 years ago
  • 9.4.0                                ...           4 years ago
  • 9.3.0                                ...           4 years ago
  • 9.2.0                                ...           4 years ago
  • 9.1.1                                ...           4 years ago
  • 9.1.0                                ...           4 years ago
  • 9.0.1                                ...           4 years ago
  • 9.0.0                                ...           4 years ago
  • 8.1.0                                ...           4 years ago
  • 8.0.0                                ...           4 years ago
  • 7.6.1                                ...           5 years ago
  • 7.6.0                                ...           5 years ago
  • 7.5.4                                ...           5 years ago
  • 7.5.3                                ...           5 years ago
  • 7.5.2                                ...           5 years ago
  • 7.5.1                                ...           5 years ago
  • 7.5.0                                ...           5 years ago
  • 7.4.0                                ...           5 years ago
  • 7.3.0                                ...           5 years ago
  • 7.2.0                                ...           5 years ago
  • 7.1.0                                ...           5 years ago
  • 7.0.1                                ...           5 years ago
  • 7.0.0                                ...           5 years ago
  • 6.0.0                                ...           5 years ago
  • 5.1.3                                ...           5 years ago
  • 5.1.2                                ...           5 years ago
  • 5.1.1                                ...           5 years ago
  • 5.1.0                                ...           5 years ago
  • 5.0.2                                ...           5 years ago
  • 5.0.1                                ...           6 years ago
  • 5.0.0                                ...           6 years ago
  • 4.8.0                                ...           6 years ago
  • 4.7.1                                ...           6 years ago
  • 4.7.0                                ...           6 years ago
  • 4.6.0                                ...           6 years ago
  • 4.5.0                                ...           6 years ago
  • 4.4.0                                ...           6 years ago
  • 4.3.0                                ...           6 years ago
  • 4.2.1                                ...           6 years ago
  • 4.2.0                                ...           6 years ago
  • 4.1.0                                ...           6 years ago
  • 4.0.3                                ...           6 years ago
  • 4.0.2                                ...           6 years ago
  • 4.0.1                                ...           6 years ago
  • 4.0.0                                ...           7 years ago
  • 3.6.1                                ...           7 years ago
  • 3.6.0                                ...           7 years ago
  • 3.5.0                                ...           7 years ago
  • 3.4.0                                ...           7 years ago
  • 3.3.0                                ...           7 years ago
  • 3.2.2                                ...           7 years ago
  • 3.2.1                                ...           7 years ago
  • 3.2.0                                ...           7 years ago
  • 3.1.0                                ...           8 years ago
  • 3.0.1                                ...           8 years ago
  • 3.0.0                                ...           8 years ago
  • 2.6.1                                ...           8 years ago
  • 3.0.0-rc.2                                ...           8 years ago
  • 3.0.0-rc.1                                ...           8 years ago
  • 2.6.0                                ...           8 years ago
  • 2.5.0                                ...           8 years ago
  • 2.4.0                                ...           8 years ago
  • 2.3.0                                ...           8 years ago
  • 2.2.4                                ...           8 years ago
  • 2.2.3                                ...           8 years ago
  • 2.2.2                                ...           8 years ago
  • 2.2.1                                ...           8 years ago
  • 2.2.0                                ...           8 years ago
  • 2.1.0                                ...           8 years ago
  • 2.0.1                                ...           8 years ago
  • 2.0.0                                ...           8 years ago
  • 2.0.0-rc.1                                ...           9 years ago
  • 1.0.1                                ...           9 years ago
  • 1.0.0                                ...           9 years ago
Downloads
Total 242
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 1
Last Month 222
Dependencies (8)
Dev Dependencies (5)

© 2010 - cnpmjs.org x YWFE | Home | YWFE