From 98e10223a637082d929dc2ac245ea1df033ef215 Mon Sep 17 00:00:00 2001 From: Aleksandr Date: Mon, 11 May 2020 20:27:46 +0300 Subject: [PATCH] Remove obsolete logger field mentions from docs (#836) Version logger field was removed in https://github.com/pinojs/pino/pull/623 but some places were missed. --- docs/api.md | 8 ++++---- docs/pretty.md | 9 ++------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/docs/api.md b/docs/api.md index b3e354b72..9e4438c40 100644 --- a/docs/api.md +++ b/docs/api.md @@ -111,9 +111,9 @@ const logger = pino({ } }) logger.info('hello') -// {"level":30,"time":1573664685466,"pid":78742,"hostname":"x","line":1,"msg":"hello","v":1} +// {"level":30,"time":1573664685466,"pid":78742,"hostname":"x","line":1,"msg":"hello"} logger.info('world') -// {"level":30,"time":1573664685469,"pid":78742,"hostname":"x","line":2,"msg":"world","v":1} +// {"level":30,"time":1573664685469,"pid":78742,"hostname":"x","line":2,"msg":"world"} ``` #### `redact` (Array | Object): @@ -285,7 +285,7 @@ The string key for the 'message' in the JSON object. Default: `null` -If there's a chance that objects being logged have properties that conflict with those from pino itself (`level`, `timestamp`, `v`, `pid`, etc) +If there's a chance that objects being logged have properties that conflict with those from pino itself (`level`, `timestamp`, `pid`, etc) and duplicate keys in your log records are undesirable, pino can be configured with a `nestedKey` option that causes any `object`s that are logged to be placed under a key whose name is the value of `nestedKey`. @@ -301,7 +301,7 @@ const thing = { level: 'hi', time: 'never', foo: 'bar'} // has pino-conflicting logger.info(thing) // logs the following: -// {"level":30,"time":1578357790020,"pid":91736,"hostname":"x","payload":{"level":"hi","time":"never","foo":"bar"},"v":1} +// {"level":30,"time":1578357790020,"pid":91736,"hostname":"x","payload":{"level":"hi","time":"never","foo":"bar"}} ``` In this way, logged objects' properties don't conflict with pino's standard logging properties, and searching for logged objects can start from a consistent path. diff --git a/docs/pretty.md b/docs/pretty.md index bd90ebb06..7e5678efa 100644 --- a/docs/pretty.md +++ b/docs/pretty.md @@ -33,9 +33,8 @@ module.exports = function myPrettifier (options) { return function prettifier (inputData) { let logObject if (typeof inputData === 'string') { - const parsedData = someJsonParser(inputData) - logObject = (isPinoLog(parsedData)) ? parsedData : undefined - } else if (isObject(inputData) && isPinoLog(inputData)) { + logObject = someJsonParser(inputData) + } else if (isObject(inputData)) { logObject = inputData } if (!logObject) return inputData @@ -45,10 +44,6 @@ module.exports = function myPrettifier (options) { function isObject (input) { return Object.prototype.toString.apply(input) === '[object Object]' } - - function isPinoLog (log) { - return log && (log.hasOwnProperty('v') && log.v === 1) - } } ```