diff --git a/lib/__tests__/misc.filterOutMetadata.js b/lib/__tests__/misc.filterOutMetadata.js index 978aff0..6f402ed 100644 --- a/lib/__tests__/misc.filterOutMetadata.js +++ b/lib/__tests__/misc.filterOutMetadata.js @@ -3,11 +3,11 @@ const { filterOutMetadata } = require('../misc') describe('filterOutMetadata', () => { it('pads small number', () => { const data = { - level: 1, time: 2, msg: 3, pid: 4, v: 5, message: 6, hostname: 7, type: 8, other: 9 + level: 1, time: 2, msg: 3, pid: 4, message: 5, hostname: 6, other: 7 } const filtered = filterOutMetadata(data) expect(Object.keys(filtered)).toHaveLength(1) expect(filtered.level).toBeUndefined() - expect(filtered.other).toBe(9) + expect(filtered.other).toBe(7) }) }) diff --git a/lib/min.js b/lib/min.js index 1c3f1f2..de983ff 100644 --- a/lib/min.js +++ b/lib/min.js @@ -12,12 +12,12 @@ const defaultOptions = { } const levels = { - 'trace': { label: 'TRAC', color: chalk.gray }, - 'debug': { label: 'DEBU', color: chalk.gray }, - 'info': { label: 'INFO', color: chalk.blue }, - 'warn': { label: 'WARN', color: chalk.yellow }, - 'error': { label: 'ERRO', color: chalk.red }, - 'fatal': { label: 'FATA', color: chalk.bold.red } + trace: { label: 'TRAC', color: chalk.gray }, + debug: { label: 'DEBU', color: chalk.gray }, + info: { label: 'INFO', color: chalk.blue }, + warn: { label: 'WARN', color: chalk.yellow }, + error: { label: 'ERRO', color: chalk.red }, + fatal: { label: 'FATA', color: chalk.bold.red } } const numericLabels = { @@ -54,9 +54,9 @@ module.exports = options => { return Object.prototype.toString.apply(input) === '[object Object]' } - // method taken from James' reference prettifier: https://github.com/pinojs/pino-pretty/ function isPinoLog (log) { - return log && (log.hasOwnProperty('v') && log.v === 1) + return log && log.hasOwnProperty('level') && log.hasOwnProperty('msg') && + log.hasOwnProperty('time') && log.hasOwnProperty('pid') && log.hasOwnProperty('hostname') } function parse (args, obj) { diff --git a/lib/misc.js b/lib/misc.js index fd7f790..836036c 100644 --- a/lib/misc.js +++ b/lib/misc.js @@ -1,7 +1,7 @@ const pad = require('pad') const stringWidth = require('unicode-string-width') -const noDefaultMetadata = (val) => !['level', 'time', 'msg', 'pid', 'v', 'message', 'hostname', 'type'].includes(val) +const noDefaultMetadata = (val) => !['level', 'time', 'msg', 'pid', 'message', 'hostname'].includes(val) module.exports.filterOutMetadata = (obj) => Object.keys(obj).filter(noDefaultMetadata).reduce((a, e) => { a[e] = obj[e] diff --git a/package.json b/package.json index b054719..382cc02 100755 --- a/package.json +++ b/package.json @@ -33,21 +33,21 @@ "author": "Andrzej Lichnerowicz ", "license": "Unlicense", "devDependencies": { - "husky": "^1.0.0-rc.2", - "jest": "^23.1.0", - "pino": "^4.11.0", - "snazzy": "^7.1.1", - "standard": "^11.0.0" + "husky": "^4.2.3", + "jest": "^25.2.7", + "pino": "^6.1.1", + "snazzy": "^8.0.0", + "standard": "^14.3.3" }, "dependencies": { - "args": "^5.0.0", - "chalk": "^2.3.1", + "args": "^5.0.1", + "chalk": "^4.0.0", "fast-json-parse": "^1.0.3", - "moment": "^2.20.1", - "pad": "^2.1.0", + "moment": "^2.24.0", + "pad": "^3.2.0", "pump": "^3.0.0", - "split2": "^2.2.0", - "through2": "^2.0.3", + "split2": "^3.1.1", + "through2": "^3.0.1", "unicode-string-width": "^0.1.0" } }