pino-pretty
Advanced tools
Comparing version 3.6.1 to 4.0.0
@@ -91,2 +91,3 @@ #!/usr/bin/env node | ||
// https://github.com/pinojs/pino/pull/358 | ||
/* istanbul ignore next */ | ||
if (!process.stdin.isTTY && !fs.fstatSync(process.stdin.fd).isFile()) { | ||
@@ -93,0 +94,0 @@ process.once('SIGINT', function noOp () {}) |
@@ -72,7 +72,2 @@ 'use strict' | ||
// Short-circuit for spec allowed primitive values. | ||
if ([null, true, false].includes(log) || Number.isFinite(log)) { | ||
return `${log}\n` | ||
} | ||
if (search && !jmespath.search(log, search)) { | ||
@@ -79,0 +74,0 @@ return |
@@ -18,3 +18,3 @@ 'use strict' | ||
const chalk = require('chalk') | ||
const ctx = new chalk.constructor({ enabled: true, level: 3 }) | ||
const ctx = new chalk.Instance({ level: 3 }) | ||
const colored = { | ||
@@ -21,0 +21,0 @@ default: ctx.white, |
@@ -326,2 +326,3 @@ 'use strict' | ||
const matches = /^(\s*"stack":)\s*(".*"),?$/.exec(line) | ||
/* istanbul ignore else */ | ||
if (matches && matches.length === 3) { | ||
@@ -328,0 +329,0 @@ const indentSize = /^\s*/.exec(line)[0].length + 4 |
{ | ||
"name": "pino-pretty", | ||
"version": "3.6.1", | ||
"version": "4.0.0", | ||
"description": "Prettifier for Pino log lines", | ||
@@ -11,5 +11,4 @@ "main": "index.js", | ||
"lint": "standard | snazzy", | ||
"lint-ci": "standard", | ||
"test": "tap --no-cov 'test/**/*.test.js'", | ||
"test-ci": "tap --cov 'test/**/*.test.js'" | ||
"test": "tap --100 'test/**/*.test.js'", | ||
"ci": "standard && tap --100 'test/**/*.test.js'" | ||
}, | ||
@@ -34,5 +33,5 @@ "repository": { | ||
"dependencies": { | ||
"@hapi/bourne": "^1.3.2", | ||
"@hapi/bourne": "^2.0.0", | ||
"args": "^5.0.1", | ||
"chalk": "^2.4.2", | ||
"chalk": "^3.0.0", | ||
"dateformat": "^3.0.3", | ||
@@ -43,3 +42,3 @@ "fast-safe-stringify": "^2.0.7", | ||
"pump": "^3.0.0", | ||
"readable-stream": "^3.4.0", | ||
"readable-stream": "^3.6.0", | ||
"split2": "^3.1.1", | ||
@@ -49,9 +48,9 @@ "strip-json-comments": "^3.0.1" | ||
"devDependencies": { | ||
"pino": "^5.14.0", | ||
"pino": "^6.0.0", | ||
"pre-commit": "^1.2.2", | ||
"rimraf": "^3.0.0", | ||
"rimraf": "^3.0.2", | ||
"snazzy": "^8.0.0", | ||
"standard": "^14.0.0", | ||
"tap": "^14.10.2" | ||
"standard": "^14.3.3", | ||
"tap": "^14.10.7" | ||
} | ||
} |
<a id="intro"></a> | ||
# pino-pretty | ||
[![NPM Package Version](https://badgen.net/npm/v/pino-pretty)](https://www.npmjs.com/package/pino-pretty) | ||
[![Build Status](https://badgen.net/travis/pinojs/pino-pretty/master)](https://travis-ci.org/pinojs/pino-pretty) | ||
[![Coverage Status](https://badgen.net/coveralls/c/github/pinojs/pino-pretty/master)](https://coveralls.io/github/pinojs/pino-pretty?branch=master) | ||
[![NPM Package Version](https://img.shields.io/npm/v/pino-pretty)](https://www.npmjs.com/package/pino-pretty) | ||
[![Build Status](https://img.shields.io/github/workflow/status/pinojs/pino-pretty/CI)](https://github.com/pinojs/pino-pretty/actions?query=workflow%3ACI) | ||
[![Coverage Status](https://img.shields.io/coveralls/github/pinojs/pino-pretty)](https://codecov.io/gh/pinojs/pino-pretty) | ||
@@ -70,3 +70,3 @@ This module provides a basic [ndjson](http://ndjson.org/) formatter. If an | ||
Default: `false` | ||
- `--timestampKey` (`-m`): Define the key that contains the log timestamp. | ||
- `--timestampKey` (`-a`): Define the key that contains the log timestamp. | ||
Default: `time`. | ||
@@ -73,0 +73,0 @@ - `--translateTime` (`-t`): Translate the epoch time value into a human readable |
@@ -25,3 +25,3 @@ 'use strict' | ||
const env = { TERM: 'dumb' } | ||
const child = spawn(process.argv0, [bin], { env, cwd: tmpDir }) | ||
const child = spawn(process.argv[0], [bin], { env, cwd: tmpDir }) | ||
// Validate that the time has been translated | ||
@@ -45,3 +45,3 @@ child.on('error', t.threw) | ||
const env = { TERM: 'dumb' } | ||
const child = spawn(process.argv0, [bin], { env, cwd: tmpDir }) | ||
const child = spawn(process.argv[0], [bin], { env, cwd: tmpDir }) | ||
// Validate that the time has been translated | ||
@@ -65,3 +65,3 @@ child.on('error', t.threw) | ||
const env = { TERM: 'dumb' } | ||
const child = spawn(process.argv0, [bin], { env, cwd: tmpDir }) | ||
const child = spawn(process.argv[0], [bin], { env, cwd: tmpDir }) | ||
// Validate that the time has been translated | ||
@@ -85,3 +85,3 @@ child.on('error', t.threw) | ||
const env = { TERM: 'dumb' } | ||
const child = spawn(process.argv0, [bin, '--config', configFile], { env, cwd: tmpDir }) | ||
const child = spawn(process.argv[0], [bin, '--config', configFile], { env, cwd: tmpDir }) | ||
// Validate that the time has been translated | ||
@@ -102,3 +102,3 @@ child.on('error', t.threw) | ||
const env = { TERM: 'dumb' } | ||
const child = spawn(process.argv0, [bin, '--config', configFile], { env, cwd: tmpDir }) | ||
const child = spawn(process.argv[0], [bin, '--config', configFile], { env, cwd: tmpDir }) | ||
// Validate that the time has been translated | ||
@@ -125,3 +125,3 @@ child.on('error', t.threw) | ||
const env = { TERM: 'dumb' } | ||
const child = spawn(process.argv0, [bin, '--messageKey', 'new_msg'], { env, cwd: tmpDir }) | ||
const child = spawn(process.argv[0], [bin, '--messageKey', 'new_msg'], { env, cwd: tmpDir }) | ||
// Validate that the time has been translated and correct message key has been used | ||
@@ -143,3 +143,3 @@ child.on('error', t.threw) | ||
const env = { TERM: 'dumb' } | ||
const child = spawn(process.argv0, args, { env, cwd: tmpDir }) | ||
const child = spawn(process.argv[0], args, { env, cwd: tmpDir }) | ||
child.on('close', (code) => t.is(code, 1)) | ||
@@ -157,3 +157,3 @@ child.stderr.on('data', (data) => { | ||
const env = { TERM: 'dumb' } | ||
const child = spawn(process.argv0, [bin], { env, cwd: tmpDir }) | ||
const child = spawn(process.argv[0], [bin], { env, cwd: tmpDir }) | ||
child.on('close', (code) => t.is(code, 1)) | ||
@@ -172,3 +172,3 @@ child.stderr.on('data', (data) => { | ||
const env = { TERM: 'dumb' } | ||
const child = spawn(process.argv0, args, { env, cwd: tmpDir }) | ||
const child = spawn(process.argv[0], args, { env, cwd: tmpDir }) | ||
child.on('close', (code) => t.is(code, 1)) | ||
@@ -175,0 +175,0 @@ child.stderr.on('data', (data) => { |
@@ -15,3 +15,3 @@ 'use strict' | ||
const env = { TERM: 'dumb' } | ||
const child = spawn(process.argv0, [bin], { env }) | ||
const child = spawn(process.argv[0], [bin], { env }) | ||
child.on('error', t.threw) | ||
@@ -28,3 +28,3 @@ child.stdout.on('data', (data) => { | ||
const env = { TERM: 'dumb' } | ||
const child = spawn(process.argv0, [bin, '-l'], { env }) | ||
const child = spawn(process.argv[0], [bin, '-l'], { env }) | ||
child.on('error', t.threw) | ||
@@ -41,3 +41,3 @@ child.stdout.on('data', (data) => { | ||
const env = { TERM: 'dumb' } | ||
const child = spawn(process.argv0, [bin, '-t'], { env }) | ||
const child = spawn(process.argv[0], [bin, '-t'], { env }) | ||
child.on('error', t.threw) | ||
@@ -54,3 +54,3 @@ child.stdout.on('data', (data) => { | ||
const env = { TERM: 'dumb' } | ||
const child = spawn(process.argv0, [bin, '-s', 'msg == `hello world`'], { env }) | ||
const child = spawn(process.argv[0], [bin, '-s', 'msg == `hello world`'], { env }) | ||
child.on('error', t.threw) | ||
@@ -67,3 +67,3 @@ child.stdout.on('data', (data) => { | ||
const env = { TERM: 'dumb' } | ||
const child = spawn(process.argv0, [bin, '-s', 'msg == `hello world`'], { env }) | ||
const child = spawn(process.argv[0], [bin, '-s', 'msg == `hello world`'], { env }) | ||
child.on('error', t.threw) | ||
@@ -81,3 +81,3 @@ child.stdout.on('data', (data) => { | ||
const env = { TERM: 'dumb' } | ||
const child = spawn(process.argv0, [bin, '-i', 'pid,hostname'], { env }) | ||
const child = spawn(process.argv[0], [bin, '-i', 'pid,hostname'], { env }) | ||
child.on('error', t.threw) | ||
@@ -94,3 +94,3 @@ child.stdout.on('data', (data) => { | ||
const env = { TERM: 'dumb' } | ||
const child = spawn(process.argv0, [bin], { env }) | ||
const child = spawn(process.argv[0], [bin], { env }) | ||
child.on('error', t.threw) | ||
@@ -97,0 +97,0 @@ |
@@ -99,2 +99,7 @@ 'use strict' | ||
t.test('returns message formatted by `messageFormat` option - missing prop', async t => { | ||
const str = prettifyMessage({ log: { context: 'appModule' }, messageFormat: '{context} - {msg}' }) | ||
t.is(str, 'appModule - ') | ||
}) | ||
t.test('`messageFormat` supports nested curly brackets', async t => { | ||
@@ -176,2 +181,7 @@ const str = prettifyMessage({ log: { level: 30 }, messageFormat: '{{level}}-{level}-{{level}-{level}}' }) | ||
t.test('works with only `caller` present', async t => { | ||
const str = prettifyMetadata({ log: { caller: 'baz' } }) | ||
t.is(str, '<baz>') | ||
}) | ||
t.test('works with only `pid`, `hostname`, & `caller` present', async t => { | ||
@@ -178,0 +188,0 @@ const str = prettifyMetadata({ log: { pid: '1234', hostname: 'bar', caller: 'baz' } }) |
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
263998
20
2127
+ Added@hapi/bourne@2.1.0(transitive)
+ Addedansi-styles@4.3.0(transitive)
+ Addedchalk@3.0.0(transitive)
+ Addedcolor-convert@2.0.1(transitive)
+ Addedcolor-name@1.1.4(transitive)
+ Addedhas-flag@4.0.0(transitive)
+ Addedsupports-color@7.2.0(transitive)
- Removed@hapi/bourne@1.3.2(transitive)
Updated@hapi/bourne@^2.0.0
Updatedchalk@^3.0.0
Updatedreadable-stream@^3.6.0