pino-pretty
Advanced tools
Comparing version 3.2.1 to 3.2.2
@@ -58,7 +58,7 @@ 'use strict' | ||
const parsed = jsonParser(inputData) | ||
log = parsed.value | ||
if (parsed.err) { | ||
if (parsed.err || !isObject(parsed.value)) { | ||
// pass through | ||
return inputData + EOL | ||
} | ||
log = parsed.value | ||
} else { | ||
@@ -65,0 +65,0 @@ log = inputData |
'use strict' | ||
/* eslint no-prototype-builtins: 0 */ | ||
const { LEVELS, LEVEL_NAMES } = require('./constants') | ||
@@ -4,0 +6,0 @@ |
{ | ||
"name": "pino-pretty", | ||
"version": "3.2.1", | ||
"version": "3.2.2", | ||
"description": "Prettifier for Pino log lines", | ||
@@ -37,15 +37,15 @@ "main": "index.js", | ||
"dateformat": "^3.0.3", | ||
"fast-safe-stringify": "^2.0.6", | ||
"fast-safe-stringify": "^2.0.7", | ||
"jmespath": "^0.15.0", | ||
"pump": "^3.0.0", | ||
"readable-stream": "^3.3.0", | ||
"readable-stream": "^3.4.0", | ||
"split2": "^3.1.1" | ||
}, | ||
"devDependencies": { | ||
"pino": "^5.12.2", | ||
"pino": "^5.13.4", | ||
"pre-commit": "^1.2.2", | ||
"snazzy": "^8.0.0", | ||
"standard": "^12.0.1", | ||
"standard": "^14.0.0", | ||
"tap": "^12.6.1" | ||
} | ||
} |
'use strict' | ||
/* eslint no-prototype-builtins: 0 */ | ||
const { Writable } = require('readable-stream') | ||
@@ -4,0 +6,0 @@ const os = require('os') |
@@ -39,3 +39,3 @@ 'use strict' | ||
child.stdout.on('data', (data) => { | ||
t.is(data.toString(), `[2018-03-30 17:35:28.992 +0000] INFO (42 on foo): hello world\n`) | ||
t.is(data.toString(), '[2018-03-30 17:35:28.992 +0000] INFO (42 on foo): hello world\n') | ||
}) | ||
@@ -74,3 +74,3 @@ child.stdin.write(logLine) | ||
child.stdout.on('data', (data) => { | ||
t.is(data.toString(), `[1522431328992] INFO : hello world\n`) | ||
t.is(data.toString(), '[1522431328992] INFO : hello world\n') | ||
}) | ||
@@ -81,3 +81,20 @@ child.stdin.write(logLine) | ||
t.test('passes through stringified date as string', (t) => { | ||
t.plan(1) | ||
const child = spawn(process.argv0, [bin]) | ||
child.on('error', t.threw) | ||
const date = JSON.stringify(new Date(epoch)) | ||
child.stdout.on('data', (data) => { | ||
t.is(data.toString(), date + '\n') | ||
}) | ||
child.stdin.write(date) | ||
child.stdin.write('\n') | ||
t.tearDown(() => child.kill()) | ||
}) | ||
t.end() | ||
}) |
@@ -25,3 +25,3 @@ 'use strict' | ||
const str = prettifyErrorLog({ log: err, eol: '\r\n' }) | ||
t.true(str.startsWith(` Error: Something went wrong\r\n`)) | ||
t.true(str.startsWith(' Error: Something went wrong\r\n')) | ||
}) | ||
@@ -154,3 +154,3 @@ | ||
const str = prettifyObject({ input: { foo: 'bar' } }) | ||
t.is(str, ` foo: "bar"\n`) | ||
t.is(str, ' foo: "bar"\n') | ||
}) | ||
@@ -160,3 +160,3 @@ | ||
const str = prettifyObject({ input: { foo: { bar: 'baz' } } }) | ||
t.is(str, ` foo: {\n "bar": "baz"\n }\n`) | ||
t.is(str, ' foo: {\n "bar": "baz"\n }\n') | ||
}) | ||
@@ -166,3 +166,3 @@ | ||
const str = prettifyObject({ input: { foo: 'bar', hello: 'world' }, skipKeys: ['foo'] }) | ||
t.is(str, ` hello: "world"\n`) | ||
t.is(str, ' hello: "world"\n') | ||
}) | ||
@@ -172,3 +172,3 @@ | ||
const str = prettifyObject({ input: { foo: 'bar', pid: 12345 } }) | ||
t.is(str, ` foo: "bar"\n`) | ||
t.is(str, ' foo: "bar"\n') | ||
}) | ||
@@ -200,3 +200,3 @@ | ||
t.test('returns prettified formatted time from custom field', async t => { | ||
let log = { customtime: 1554642900000 } | ||
const log = { customtime: 1554642900000 } | ||
let str = prettifyTime({ log, translateFormat: true, timestampKey: 'customtime' }) | ||
@@ -203,0 +203,0 @@ t.is(str, '[2019-04-07 13:15:00.000 +0000]') |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
247595
1746
Updatedfast-safe-stringify@^2.0.7
Updatedreadable-stream@^3.4.0