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 to 2.0.1

6

index.js

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

const defaultOptions = {
colorize: false,
colorize: chalk.supportsColor,
crlf: false,

@@ -248,3 +248,5 @@ errorLikeObjectKeys: ['err', 'error'],

} else if (filteredKeys.indexOf(keys[i]) < 0) {
result += IDENT + keys[i] + ': ' + joinLinesWithIndentation(JSON.stringify(value[keys[i]], null, 2)) + EOL
if (value[keys[i]] !== undefined) {
result += IDENT + keys[i] + ': ' + joinLinesWithIndentation(JSON.stringify(value[keys[i]], null, 2)) + EOL
}
}

@@ -251,0 +253,0 @@ }

{
"name": "pino-pretty",
"version": "2.0.0",
"version": "2.0.1",
"description": "Prettifier for Pino log lines",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -54,8 +54,2 @@ <a id="intro"></a>

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

@@ -68,6 +62,10 @@ 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. See `--dateFormat` for information on the output format.
date and time string. This flag also can set the format string to apply when
translating the date to human readable format. For a list of available pattern
letters see the [`dateformat` documentation](https://www.npmjs.com/package/dateformat).
- The default format is `yyyy-mm-dd HH:MM:ss.l o` in UTC.
- Require a `SYS:` prefix to translate time to the local system's timezone. A
shortcut `SYS:standard` to translate time to `yyyy-mm-dd HH:MM:ss.l o` in
system timezone.
+ `--search` (`-s`): Specifiy a search pattern according to

@@ -120,9 +118,7 @@ [jmespath](http://jmespath.org/).

{
colorize: false, // --colorize
colorize: chalk.supportsColor, // --colorize
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

@@ -134,2 +130,4 @@ translateTime: false // --translateTime

The `colorize` default follows
[`chalk.supportsColor](https://www.npmjs.com/package/chalk#chalksupportscolor).

@@ -136,0 +134,0 @@ <a id="license"><a>

@@ -25,3 +25,2 @@ 'use strict'

delete Date.originalNow
done()

@@ -437,3 +436,22 @@ })

t.test('formats a line with an undefined field', (t) => {
t.plan(1)
const pretty = prettyFactory()
const log = pino({}, new Writable({
write (chunk, enc, cb) {
const obj = JSON.parse(chunk.toString())
// weird hack, but we should not crash
obj.a = undefined
const formatted = pretty(obj)
t.is(
formatted,
`[${epoch}] INFO (${pid} on ${hostname}): foo\n`
)
cb()
}
}))
log.info('foo')
})
t.end()
})
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