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.5.0 to 2.6.0

4

bin.js

@@ -19,3 +19,4 @@ #!/usr/bin/env node

.option(['t', 'translateTime'], 'Display epoch timestamps as UTC ISO format or according to an optional format string (default ISO 8601)')
.option(['s', 'search'], 'specifiy a search pattern according to jmespath')
.option(['s', 'search'], 'Specify a search pattern according to jmespath')
.option(['i', 'ignore'], 'Ignore one or several keys: (`-i time,hostname`)')

@@ -29,2 +30,3 @@ args

.example('cat log | pino-pretty -s "msg == \'hello world\'"', 'Only prints messages with msg equals to \'hello world\'')
.example('cat log | pino-pretty -i pid,hostname', 'Prettify logs but don\'t print pid and hostname')

@@ -31,0 +33,0 @@ const opts = args.parse(process.argv)

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

const errorProps = opts.errorProps.split(',')
const ignoreKeys = opts.ignore ? new Set(opts.ignore.split(',')) : undefined

@@ -112,2 +113,11 @@ const color = {

if (ignoreKeys) {
log = Object.keys(log)
.filter(key => !ignoreKeys.has(key))
.reduce((res, key) => {
res[key] = log[key]
return res
}, {})
}
const standardKeys = [

@@ -154,3 +164,6 @@ 'pid',

if (log.hostname) {
line += ' on ' + log.hostname
if (line.slice(-1) !== '(') {
line += ' '
}
line += 'on ' + log.hostname
}

@@ -157,0 +170,0 @@

{
"name": "pino-pretty",
"version": "2.5.0",
"version": "2.6.0",
"description": "Prettifier for Pino log lines",

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

@@ -69,4 +69,5 @@ <a id="intro"></a>

system timezone.
+ `--search` (`-s`): Specifiy a search pattern according to
+ `--search` (`-s`): Specify a search pattern according to
[jmespath](http://jmespath.org/).
+ `--ignore` (`-i`): Ignore one or several keys: (`-i time,hostname`)

@@ -79,3 +80,3 @@ <a id="integration"></a>

When installed, `pretty-print` will be used by `pino` as the default
When installed, `pino-pretty` will be used by `pino` as the default
prettifier.

@@ -124,4 +125,5 @@

messageKey: 'msg', // --messageKey
translateTime: false // --translateTime
search: 'foo == `bar`' // --search
translateTime: false, // --translateTime
search: 'foo == `bar`', // --search
ignore: 'pid,hostname' // --ignore
}

@@ -128,0 +130,0 @@ ```

@@ -542,3 +542,17 @@ 'use strict'

t.test('ignores multiple keys', (t) => {
t.plan(1)
const pretty = prettyFactory({ ignore: 'pid,hostname' })
const arst = pretty(`{"msg":"hello world", "pid":"${pid}", "hostname":"${hostname}", "time":${epoch}, "level":30, "v":1}`)
t.is(arst, `[${epoch}] INFO : hello world\n`)
})
t.test('ignores a single key', (t) => {
t.plan(1)
const pretty = prettyFactory({ ignore: 'pid' })
const arst = pretty(`{"msg":"hello world", "pid":"${pid}", "hostname":"${hostname}", "time":${epoch}, "level":30, "v":1}`)
t.is(arst, `[${epoch}] INFO (on ${hostname}): hello world\n`)
})
t.end()
})

@@ -56,3 +56,14 @@ 'use strict'

t.test('does ignore multiple keys', (t) => {
t.plan(1)
const child = spawn(process.argv0, [bin, '-i', 'pid,hostname'])
child.on('error', t.threw)
child.stdout.on('data', (data) => {
t.is(data.toString(), `[1522431328992] INFO : hello world\n`)
})
child.stdin.write(logLine)
t.tearDown(() => child.kill())
})
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