pino-pretty
Advanced tools
Comparing version 2.1.0 to 2.2.0
16
bin.js
@@ -7,3 +7,3 @@ #!/usr/bin/env node | ||
const split = require('split2') | ||
const through = require('through2') | ||
const { Transform } = require('readable-stream') | ||
const prettyFactory = require('./') | ||
@@ -32,10 +32,12 @@ const CONSTANTS = require('./lib/constants') | ||
const pretty = prettyFactory(opts) | ||
const prettyTransport = through.obj(function (chunk, enc, cb) { | ||
const line = pretty(chunk.toString()) | ||
if (line === undefined) return cb() | ||
process.stdout.write(line) | ||
cb() | ||
const prettyTransport = new Transform({ | ||
objectMode: true, | ||
transform (chunk, enc, cb) { | ||
const line = pretty(chunk.toString()) | ||
if (line === undefined) return cb() | ||
cb(null, line) | ||
} | ||
}) | ||
pump(process.stdin, split(), prettyTransport) | ||
pump(process.stdin, split(), prettyTransport, process.stdout) | ||
@@ -42,0 +44,0 @@ // https://github.com/pinojs/pino/pull/358 |
@@ -78,3 +78,3 @@ 'use strict' | ||
if (opts.colorize) { | ||
const ctx = new chalk.constructor({enabled: true, level: 3}) | ||
const ctx = new chalk.constructor({ enabled: true, level: 3 }) | ||
color.default = ctx.white | ||
@@ -81,0 +81,0 @@ color[60] = ctx.bgRed |
{ | ||
"name": "pino-pretty", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "Prettifier for Pino log lines", | ||
@@ -39,12 +39,12 @@ "main": "index.js", | ||
"pump": "^3.0.0", | ||
"split2": "^2.2.0", | ||
"through2": "^2.0.3" | ||
"readable-stream": "^3.0.2", | ||
"split2": "^3.0.0" | ||
}, | ||
"devDependencies": { | ||
"pino": "^5.0.0", | ||
"pino": "^5.5.0", | ||
"pre-commit": "^1.2.2", | ||
"snazzy": "^7.1.1", | ||
"standard": "^11.0.1", | ||
"standard": "^12.0.1", | ||
"tap": "^12.0.1" | ||
} | ||
} |
'use strict' | ||
const Writable = require('stream').Writable | ||
const { Writable } = require('readable-stream') | ||
const os = require('os') | ||
@@ -53,3 +53,3 @@ const test = require('tap').test | ||
t.plan(1) | ||
const pretty = prettyFactory({colorize: true}) | ||
const pretty = prettyFactory({ colorize: true }) | ||
const log = pino({}, new Writable({ | ||
@@ -70,3 +70,3 @@ write (chunk, enc, cb) { | ||
t.plan(1) | ||
const pretty = prettyFactory({levelFirst: true}) | ||
const pretty = prettyFactory({ levelFirst: true }) | ||
const log = pino({}, new Writable({ | ||
@@ -87,3 +87,3 @@ write (chunk, enc, cb) { | ||
t.plan(1) | ||
const pretty = prettyFactory({messageKey: 'bar'}) | ||
const pretty = prettyFactory({ messageKey: 'bar' }) | ||
const log = pino({}, new Writable({ | ||
@@ -99,3 +99,3 @@ write (chunk, enc, cb) { | ||
})) | ||
log.info({bar: 'baz'}) | ||
log.info({ bar: 'baz' }) | ||
}) | ||
@@ -105,3 +105,3 @@ | ||
t.plan(1) | ||
const pretty = prettyFactory({translateTime: true}) | ||
const pretty = prettyFactory({ translateTime: true }) | ||
const log = pino({}, new Writable({ | ||
@@ -188,3 +188,3 @@ write (chunk, enc, cb) { | ||
const pretty = prettyFactory() | ||
const log = pino({base: null}, new Writable({ | ||
const log = pino({ base: null }, new Writable({ | ||
write (chunk, enc, cb) { | ||
@@ -273,3 +273,3 @@ const formatted = pretty(chunk.toString()) | ||
const pretty = prettyFactory() | ||
const log = pino({timestamp: null}, new Writable({ | ||
const log = pino({ timestamp: null }, new Writable({ | ||
write (chunk, enc, cb) { | ||
@@ -294,3 +294,3 @@ const formatted = pretty(chunk.toString()) | ||
})) | ||
log.info({a: 'b'}, 'hello world') | ||
log.info({ a: 'b' }, 'hello world') | ||
}) | ||
@@ -326,3 +326,3 @@ | ||
const pretty = prettyFactory() | ||
const log = pino({name: 'matteo'}, new Writable({ | ||
const log = pino({ name: 'matteo' }, new Writable({ | ||
write (chunk, enc, cb) { | ||
@@ -361,3 +361,3 @@ const formatted = pretty(chunk.toString()) | ||
const pretty = prettyFactory() | ||
const log = pino({customLevels: {testCustom: 35}}, new Writable({ | ||
const log = pino({ customLevels: { testCustom: 35 } }, new Writable({ | ||
write (chunk, enc, cb) { | ||
@@ -438,3 +438,3 @@ const formatted = pretty(chunk.toString()) | ||
t.plan(2) | ||
const pretty = prettyFactory({search: 'msg == \'hello world\''}) | ||
const pretty = prettyFactory({ search: 'msg == \'hello world\'' }) | ||
let formatted = pretty(`{"msg":"nope", "time":${epoch}, "level":30, "v":1}`) | ||
@@ -441,0 +441,0 @@ t.is(formatted, undefined) |
@@ -18,3 +18,3 @@ 'use strict' | ||
t.plan(1) | ||
const pretty = prettyFactory({crlf: true}) | ||
const pretty = prettyFactory({ crlf: true }) | ||
const formatted = pretty(logLine) | ||
@@ -21,0 +21,0 @@ t.is(formatted.substr(-3), 'd\r\n') |
@@ -51,3 +51,3 @@ 'use strict' | ||
t.plan(3) | ||
const pretty = prettyFactory({errorProps: 'statusCode,originalStack'}) | ||
const pretty = prettyFactory({ errorProps: 'statusCode,originalStack' }) | ||
const log = pino({}, new Writable({ | ||
@@ -81,3 +81,3 @@ write (chunk, enc, cb) { | ||
const log = pino({serializers: {err: serializers.err}}, new Writable({ | ||
const log = pino({ serializers: { err: serializers.err } }, new Writable({ | ||
write (chunk, enc, cb) { | ||
@@ -99,3 +99,3 @@ const formatted = pretty(chunk.toString()) | ||
log.info({err}) | ||
log.info({ err }) | ||
}) | ||
@@ -114,3 +114,3 @@ | ||
const log = pino({serializers: {err: serializers.err}}, new Writable({ | ||
const log = pino({ serializers: { err: serializers.err } }, new Writable({ | ||
write (chunk, enc, cb) { | ||
@@ -133,3 +133,3 @@ const formatted = pretty(chunk.toString()) | ||
log.info({err}) | ||
log.info({ err }) | ||
}) | ||
@@ -139,3 +139,3 @@ | ||
t.plan(9) | ||
const pretty = prettyFactory({errorProps: '*'}) | ||
const pretty = prettyFactory({ errorProps: '*' }) | ||
const expectedLines = [ | ||
@@ -190,3 +190,3 @@ ' error stack', | ||
const error = {message: 'foo', stack: null} | ||
const error = { message: 'foo', stack: null } | ||
log.error(error) | ||
@@ -193,0 +193,0 @@ }) |
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
216404
930
+ Addedreadable-stream@^3.0.2
+ Addedreadable-stream@3.6.2(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedsplit2@3.2.2(transitive)
+ Addedstring_decoder@1.3.0(transitive)
- Removedthrough2@^2.0.3
- Removedcore-util-is@1.0.3(transitive)
- Removedisarray@1.0.0(transitive)
- Removedprocess-nextick-args@2.0.1(transitive)
- Removedreadable-stream@2.3.8(transitive)
- Removedsafe-buffer@5.1.2(transitive)
- Removedsplit2@2.2.0(transitive)
- Removedstring_decoder@1.1.1(transitive)
- Removedthrough2@2.0.5(transitive)
- Removedxtend@4.0.2(transitive)
Updatedsplit2@^3.0.0