pino-pretty
Advanced tools
Comparing version 10.2.3 to 10.3.0
138
bin.js
@@ -36,82 +36,78 @@ #!/usr/bin/env node | ||
helper(cmd) | ||
if (cmd.h || cmd.help) { | ||
help.toStdout() | ||
} else { | ||
const DEFAULT_VALUE = '\0default' | ||
const DEFAULT_VALUE = '\0default' | ||
let opts = minimist(process.argv, { | ||
alias: { | ||
colorize: 'c', | ||
colorizeObjects: 'C', | ||
crlf: 'f', | ||
errorProps: 'e', | ||
levelFirst: 'l', | ||
minimumLevel: 'L', | ||
customLevels: 'x', | ||
customColors: 'X', | ||
useOnlyCustomProps: 'U', | ||
errorLikeObjectKeys: 'k', | ||
messageKey: 'm', | ||
levelKey: CONSTANTS.LEVEL_KEY, | ||
levelLabel: 'b', | ||
messageFormat: 'o', | ||
timestampKey: 'a', | ||
translateTime: 't', | ||
ignore: 'i', | ||
include: 'I', | ||
hideObject: 'H', | ||
singleLine: 'S' | ||
}, | ||
default: { | ||
messageKey: DEFAULT_VALUE, | ||
minimumLevel: DEFAULT_VALUE, | ||
levelKey: DEFAULT_VALUE, | ||
timestampKey: DEFAULT_VALUE | ||
} | ||
}) | ||
let opts = minimist(process.argv, { | ||
alias: { | ||
colorize: 'c', | ||
colorizeObjects: 'C', | ||
crlf: 'f', | ||
errorProps: 'e', | ||
levelFirst: 'l', | ||
minimumLevel: 'L', | ||
customLevels: 'x', | ||
customColors: 'X', | ||
useOnlyCustomProps: 'U', | ||
errorLikeObjectKeys: 'k', | ||
messageKey: 'm', | ||
levelKey: CONSTANTS.LEVEL_KEY, | ||
levelLabel: 'b', | ||
messageFormat: 'o', | ||
timestampKey: 'a', | ||
translateTime: 't', | ||
ignore: 'i', | ||
include: 'I', | ||
hideObject: 'H', | ||
singleLine: 'S' | ||
}, | ||
default: { | ||
messageKey: DEFAULT_VALUE, | ||
minimumLevel: DEFAULT_VALUE, | ||
levelKey: DEFAULT_VALUE, | ||
timestampKey: DEFAULT_VALUE | ||
} | ||
}) | ||
// Remove default values | ||
opts = filter(opts, value => value !== DEFAULT_VALUE) | ||
const config = loadConfig(opts.config) | ||
// Override config with cli options | ||
opts = Object.assign({}, config, opts) | ||
// set defaults | ||
opts.errorLikeObjectKeys = opts.errorLikeObjectKeys || 'err,error' | ||
opts.errorProps = opts.errorProps || '' | ||
// Remove default values | ||
opts = filter(opts, value => value !== DEFAULT_VALUE) | ||
const config = loadConfig(opts.config) | ||
// Override config with cli options | ||
opts = Object.assign({}, config, opts) | ||
// set defaults | ||
opts.errorLikeObjectKeys = opts.errorLikeObjectKeys || 'err,error' | ||
opts.errorProps = opts.errorProps || '' | ||
const res = build(opts) | ||
pump(process.stdin, res) | ||
const res = build(opts) | ||
pump(process.stdin, res) | ||
// https://github.com/pinojs/pino/pull/358 | ||
/* istanbul ignore next */ | ||
if (!process.stdin.isTTY && !fs.fstatSync(process.stdin.fd).isFile()) { | ||
process.once('SIGINT', function noOp () {}) | ||
} | ||
function loadConfig (configPath) { | ||
const files = configPath ? [path.resolve(configPath)] : undefined | ||
const result = joycon.loadSync(files) | ||
if (result.path && !isObject(result.data)) { | ||
configPath = configPath || path.basename(result.path) | ||
throw new Error(`Invalid runtime configuration file: ${configPath}`) | ||
// https://github.com/pinojs/pino/pull/358 | ||
/* istanbul ignore next */ | ||
if (!process.stdin.isTTY && !fs.fstatSync(process.stdin.fd).isFile()) { | ||
process.once('SIGINT', function noOp () {}) | ||
} | ||
if (configPath && !result.data) { | ||
throw new Error(`Failed to load runtime configuration file: ${configPath}`) | ||
} | ||
return result.data | ||
} | ||
function filter (obj, cb) { | ||
return Object.keys(obj).reduce((acc, key) => { | ||
const value = obj[key] | ||
if (cb(value, key)) { | ||
acc[key] = value | ||
function loadConfig (configPath) { | ||
const files = configPath ? [path.resolve(configPath)] : undefined | ||
const result = joycon.loadSync(files) | ||
if (result.path && !isObject(result.data)) { | ||
configPath = configPath || path.basename(result.path) | ||
throw new Error(`Invalid runtime configuration file: ${configPath}`) | ||
} | ||
return acc | ||
}, {}) | ||
} | ||
if (configPath && !result.data) { | ||
throw new Error(`Failed to load runtime configuration file: ${configPath}`) | ||
} | ||
return result.data | ||
} | ||
function helper (cmd) { | ||
if (cmd.h || cmd.help) { | ||
help.toStdout() | ||
function filter (obj, cb) { | ||
return Object.keys(obj).reduce((acc, key) => { | ||
const value = obj[key] | ||
if (cb(value, key)) { | ||
acc[key] = value | ||
} | ||
return acc | ||
}, {}) | ||
} | ||
} |
{ | ||
"name": "pino-pretty", | ||
"version": "10.2.3", | ||
"version": "10.3.0", | ||
"description": "Prettifier for Pino log lines", | ||
@@ -41,3 +41,3 @@ "type": "commonjs", | ||
"fast-safe-stringify": "^2.1.1", | ||
"help-me": "^4.0.1", | ||
"help-me": "^5.0.0", | ||
"joycon": "^3.1.1", | ||
@@ -44,0 +44,0 @@ "minimist": "^1.2.6", |
@@ -255,3 +255,2 @@ <a id="intro"></a> | ||
singleLine: false, // --singleLine | ||
config: '/path/to/config/', // --config | ||
customColors: 'err:red,info:blue', // --customColors | ||
@@ -315,8 +314,8 @@ customLevels: 'err:99,info:1', // --customLevels | ||
// By default this will be the same numerics as the Pino default: | ||
level: logLevel => `LEVEL: ${logLevel}` | ||
level: logLevel => `LEVEL: ${logLevel}`, | ||
// other prettifiers can be used for the other keys if needed, for example | ||
hostname: hostname => colorGreen(hostname) | ||
pid: pid => colorRed(pid) | ||
name: name => colorBlue(name) | ||
hostname: hostname => colorGreen(hostname), | ||
pid: pid => colorRed(pid), | ||
name: name => colorBlue(name), | ||
caller: caller => colorCyan(caller) | ||
@@ -323,0 +322,0 @@ } |
Sorry, the diff of this file is not supported yet
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
219485
5401
381
+ Addedhelp-me@5.0.0(transitive)
- Removedbalanced-match@1.0.2(transitive)
- Removedbrace-expansion@2.0.1(transitive)
- Removedfs.realpath@1.0.0(transitive)
- Removedglob@8.1.0(transitive)
- Removedhelp-me@4.2.0(transitive)
- Removedinflight@1.0.6(transitive)
- Removedinherits@2.0.4(transitive)
- Removedminimatch@5.1.6(transitive)
- Removedreadable-stream@3.6.2(transitive)
- Removedutil-deprecate@1.0.2(transitive)
Updatedhelp-me@^5.0.0