pino-pretty
Advanced tools
Comparing version 4.1.0 to 4.2.0
@@ -41,5 +41,4 @@ 'use strict' | ||
'timestamp', | ||
'v', | ||
'caller' | ||
] | ||
} |
{ | ||
"name": "pino-pretty", | ||
"version": "4.1.0", | ||
"version": "4.2.0", | ||
"description": "Prettifier for Pino log lines", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -475,5 +475,5 @@ 'use strict' | ||
const pretty = prettyFactory({ search: 'msg == \'hello world\'' }) | ||
let formatted = pretty(`{"msg":"nope", "time":${epoch}, "level":30, "v":1}`) | ||
let formatted = pretty(`{"msg":"nope", "time":${epoch}, "level":30}`) | ||
t.is(formatted, undefined) | ||
formatted = pretty(`{"msg":"hello world", "time":${epoch}, "level":30, "v":1}`) | ||
formatted = pretty(`{"msg":"hello world", "time":${epoch}, "level":30}`) | ||
t.is(formatted, `[${epoch}] INFO : hello world\n`) | ||
@@ -563,3 +563,3 @@ }) | ||
}) | ||
const arst = pretty('{"msg":"hello world", "foo": "bar", "cow": "moo", "level":30, "v":1}') | ||
const arst = pretty('{"msg":"hello world", "foo": "bar", "cow": "moo", "level":30}') | ||
t.is(arst, 'INFO : hello world\n foo: bar_baz\n multiline\n cow: MOO\n') | ||
@@ -576,3 +576,3 @@ }) | ||
}) | ||
const arst = pretty('{"msg":"hello world", "foo": "bar", "level":30, "v":1}') | ||
const arst = pretty('{"msg":"hello world", "foo": "bar", "level":30}') | ||
t.is(arst, 'INFO : hello world\n foo: bar_baz\n') | ||
@@ -609,3 +609,3 @@ }) | ||
const pretty = prettyFactory({ ignore: 'pid,hostname' }) | ||
const arst = pretty(`{"msg":"hello world", "pid":"${pid}", "hostname":"${hostname}", "time":${epoch}, "level":30, "v":1}`) | ||
const arst = pretty(`{"msg":"hello world", "pid":"${pid}", "hostname":"${hostname}", "time":${epoch}, "level":30}`) | ||
t.is(arst, `[${epoch}] INFO : hello world\n`) | ||
@@ -617,3 +617,3 @@ }) | ||
const pretty = prettyFactory({ ignore: 'pid' }) | ||
const arst = pretty(`{"msg":"hello world", "pid":"${pid}", "hostname":"${hostname}", "time":${epoch}, "level":30, "v":1}`) | ||
const arst = pretty(`{"msg":"hello world", "pid":"${pid}", "hostname":"${hostname}", "time":${epoch}, "level":30}`) | ||
t.is(arst, `[${epoch}] INFO (on ${hostname}): hello world\n`) | ||
@@ -625,3 +625,3 @@ }) | ||
const pretty = prettyFactory({ ignore: 'time' }) | ||
const arst = pretty(`{"msg":"hello world", "pid":"${pid}", "hostname":"${hostname}", "time":${epoch}, "level":30, "v":1}`) | ||
const arst = pretty(`{"msg":"hello world", "pid":"${pid}", "hostname":"${hostname}", "time":${epoch}, "level":30}`) | ||
t.is(arst, `INFO (${pid} on ${hostname}): hello world\n`) | ||
@@ -666,3 +666,16 @@ }) | ||
t.test('keeps "v" key in log', (t) => { | ||
t.plan(1) | ||
const pretty = prettyFactory({ ignore: 'time' }) | ||
const log = pino({}, new Writable({ | ||
write (chunk, enc, cb) { | ||
const formatted = pretty(chunk.toString()) | ||
t.is(formatted, `INFO (${pid} on ${hostname}):\n v: 1\n`) | ||
cb() | ||
} | ||
})) | ||
log.info({ v: 1 }) | ||
}) | ||
t.end() | ||
}) |
@@ -10,3 +10,3 @@ 'use strict' | ||
const bin = require.resolve('../bin') | ||
const logLine = '{"level":30,"time":1522431328992,"msg":"hello world","pid":42,"hostname":"foo","v":1}\n' | ||
const logLine = '{"level":30,"time":1522431328992,"msg":"hello world","pid":42,"hostname":"foo"}\n' | ||
const noop = () => {} | ||
@@ -13,0 +13,0 @@ |
@@ -9,3 +9,3 @@ 'use strict' | ||
const epoch = 1522431328992 | ||
const logLine = '{"level":30,"time":1522431328992,"msg":"hello world","pid":42,"hostname":"foo","v":1}\n' | ||
const logLine = '{"level":30,"time":1522431328992,"msg":"hello world","pid":42,"hostname":"foo"}\n' | ||
@@ -12,0 +12,0 @@ test('cli', (t) => { |
@@ -15,3 +15,3 @@ 'use strict' | ||
const logLine = '{"level":30,"time":1522431328992,"msg":"hello world","pid":42,"hostname":"foo","v":1}\n' | ||
const logLine = '{"level":30,"time":1522431328992,"msg":"hello world","pid":42,"hostname":"foo"}\n' | ||
@@ -18,0 +18,0 @@ test('crlf', (t) => { |
268180
2190