Socket
Socket
Sign inDemoInstall

pino-pretty

Package Overview
Dependencies
Maintainers
4
Versions
88
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pino-pretty - npm Package Compare versions

Comparing version 2.0.0-rc.1 to 2.0.0

8

package.json
{
"name": "pino-pretty",
"version": "2.0.0-rc.1",
"version": "2.0.0",
"description": "Prettifier for Pino log lines",

@@ -33,3 +33,3 @@ "main": "index.js",

"dependencies": {
"args": "^4.0.0",
"args": "^5.0.0",
"chalk": "^2.3.2",

@@ -44,8 +44,8 @@ "dateformat": "^3.0.3",

"devDependencies": {
"pino": "^5.0.0-rc.2",
"pino": "^5.0.0",
"pre-commit": "^1.2.2",
"snazzy": "^7.1.1",
"standard": "^11.0.1",
"tap": "^11.1.3"
"tap": "^12.0.1"
}
}

@@ -37,4 +37,15 @@ <a id="intro"></a>

<a id="usage"></a>
## Usage
It's recommended to use `pino-pretty` with `pino`
by piping output to the CLI tool:
```sh
pino app.js | pino-pretty
```
<a id="cliargs"></a>
## CLI Arguments
### CLI Arguments

@@ -44,2 +55,8 @@ + `--colorize` (`-c`): Adds terminal color escape sequences to the output.

feed, to the formatted log line.
+ `--dateFormat` (`-d`): Sets the format string to apply when translating the date
to human readable format (see: `--translateTime`). The default format string
is `'yyyy-mm-dd HH:MM:ss.l o'`. For a list of available pattern letters
see the [`dateformat` documentation](https://www.npmjs.com/package/dateformat).
When the value is anything other than the default value, `--translateTime` is
implied.
+ `--errorProps` (`-e`): When formatting an error object, display this list

@@ -52,16 +69,50 @@ of properties. The list should be a comma separated list of properties Default: `''`.

Default: `msg`.
+ `--localTime` (`-n`): When translating the time to a human readable format,
use the system timezone for displaying the time.
+ `--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](https://www.npmjs.com/package/dateformat#mask-options)
for more available pattern letters.
date and time string. See `--dateFormat` for information on the output format.
+ `--search` (`-s`): Specifiy a search pattern according to
[jmespath](http://jmespath.org/).
<a id="api"></a>
## API
<a id="integration"></a>
## Programmatic Integration
We recommend against using `pino-pretty` in production, and highly
recommend installing `pino-pretty` as a development dependency.
When installed, `pretty-print` will be used by `pino` as the default
prettifier.
Install `pino-pretty` alongside `pino` and set the
`prettyPrint` option to `true`:
```js
const pino = require('pino')
const logger = pino({
prettyPrint: true
})
logger.info('hi')
```
The `prettyPrint` option can also be an object containing `pretty-print`
options:
```js
const pino = require('pino')
const logger = pino({
prettyPrint: { colorize: true }
})
logger.info('hi')
```
See the [Options](#options) section for all possible options.
<a id="options"></a>
### Options
`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](#cliargs):
This factory function is used internally by pino, and accepts an options argument
with keys corresponding to the options described in [CLI Arguments](#cliargs):

@@ -72,7 +123,9 @@ ```js

crlf: false, // --crlf
dateFormat: 'yyyy-mm-dd HH:MM:ss.l o', // --dateFormat
errorLikeObjectKeys: ['err', 'error'], // --errorLikeObjectKeys
errorProps: '', // --errorProps
levelFirst: false, // --levelFirst
localTime: false, // --localTime
messageKey: 'msg', // --messageKey
translateTime: false, // --translateTime
translateTime: false // --translateTime
search: 'foo == `bar`' // --search

@@ -82,7 +135,3 @@ }

See the [Pino's prettifier documentation](#usemetadata) for information on how
to use this directly with `pino`.
[#usemetadata]: https://getpino.io/#/docs/pretty
<a id="license"><a>

@@ -89,0 +138,0 @@ ## License

@@ -353,3 +353,3 @@ 'use strict'

const pretty = prettyFactory()
const log = pino({level: 'testCustom', levelVal: 35}, new Writable({
const log = pino({customLevels: {testCustom: 35}}, new Writable({
write (chunk, enc, cb) {

@@ -356,0 +356,0 @@ const formatted = pretty(chunk.toString())

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc