Comparing version 4.5.1 to 4.5.2
{ | ||
"name": "pino", | ||
"version": "4.5.1", | ||
"version": "4.5.2", | ||
"description": "super fast, all natural json logger", | ||
@@ -68,3 +68,3 @@ "main": "pino.js", | ||
"pre-commit": "^1.2.2", | ||
"snazzy": "^6.0.0", | ||
"snazzy": "^7.0.0", | ||
"standard": "^10.0.0", | ||
@@ -71,0 +71,0 @@ "steed": "^1.1.3", |
@@ -108,4 +108,4 @@ 'use strict' | ||
line = (levelFirst) | ||
? asColoredLevel(value) + ' [' + asISODate(value.time) + ']' | ||
: '[' + asISODate(value.time) + '] ' + asColoredLevel(value) | ||
? asColoredLevel(value) + ' ' + formatTime(value) | ||
: formatTime(value, ' ') + asColoredLevel(value) | ||
@@ -134,2 +134,15 @@ line += ' (' | ||
function formatTime (value, after) { | ||
after = after || '' | ||
try { | ||
if (!value || !value.time) { | ||
return '' | ||
} else { | ||
return '[' + asISODate(value.time) + ']' + after | ||
} | ||
} catch (_) { | ||
return '' | ||
} | ||
} | ||
function asColoredLevel (value) { | ||
@@ -136,0 +149,0 @@ if (levelColors.hasOwnProperty(value.level)) { |
@@ -234,1 +234,19 @@ 'use strict' | ||
}) | ||
test('works without time', function (t) { | ||
t.plan(4) | ||
var prettier = pretty() | ||
prettier.pipe(split(function (line) { | ||
t.ok(line.match(/.*hello world$/), 'end of line matches') | ||
t.ok(line.match(/^INFO.*/), 'includes level') | ||
t.ok(line.indexOf('' + process.pid) > 0, 'includes pid') | ||
t.ok(line.indexOf('' + hostname) > 0, 'includes hostname') | ||
return line | ||
})) | ||
var instance = pino({ | ||
timestamp: null | ||
}, prettier) | ||
instance.info('hello world') | ||
}) |
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
131768
3071