Skip to content

Commit

Permalink
Remove obsolete logger field mentions from docs (#836)
Browse files Browse the repository at this point in the history
Version logger field was removed in #623 but some places were missed.
  • Loading branch information
AleksandrSl committed May 11, 2020
1 parent bf0144b commit 98e1022
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
8 changes: 4 additions & 4 deletions docs/api.md
Expand Up @@ -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):
Expand Down Expand Up @@ -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`.

Expand All @@ -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.
Expand Down
9 changes: 2 additions & 7 deletions docs/pretty.md
Expand Up @@ -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
Expand All @@ -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)
}
}
```

Expand Down

0 comments on commit 98e1022

Please sign in to comment.