Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pino

Package Overview
Dependencies
Maintainers
4
Versions
311
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pino - npm Package Compare versions

Comparing version 6.4.1 to 6.5.0

8

docs/api.md

@@ -473,3 +473,3 @@ # API

<a id=message></a>
<a id="message"></a>
#### `message` (String)

@@ -492,4 +492,4 @@

the `message` parameter not the value of the `msg` property on the `mergedObject`.
In case this conflict occurs, the `msg` property from the object will be preserved
in the key `originalMsg`.
See [Avoid Message Conflict](./help.md#avoid-message-conflict) for information
on how to overcome this limitation.

@@ -512,3 +512,3 @@ The `messageKey` option can be used at instantiation time to change the namespace

<a id=interpolationvalues></a>
<a id="interpolationvalues"></a>
#### `...interpolationValues` (Any)

@@ -515,0 +515,0 @@

@@ -15,2 +15,3 @@ # Help

* [Mapping Pino Log Levels to Google Cloud Logging (Stackdriver) Serverity Levels](#stackdriver)
* [Avoid Message Conflict](#avoid-message-conflict)

@@ -286,1 +287,32 @@ <a id="exit-logging"></a>

```
<a id="avoid-message-conflict"></a>
## Avoid Message Conflict
As described in the [`message` documentation](./api.md#message), when a log
is written like `log.info({ msg: 'a message' }, 'another message')` then the
final output JSON will have `"msg":"another message"` and the `'a message'`
string will be lost. To overcome this, the [`logMethod` hook](./api.md#logmethod)
can be used:
```js
'use strict'
const log = require('pino')({
level: 'debug',
hooks: {
logMethod (inputArgs, method) {
if (inputArgs.length === 2 && inputArgs[0].msg) {
inputArgs[0].originalMsg = inputArgs[0].msg
}
return method.apply(this, inputArgs)
}
}
})
log.info('no original message')
log.info({ msg: 'mapped to originalMsg' }, 'a message')
// {"level":30,"time":1596313323106,"pid":63739,"hostname":"foo","msg":"no original message"}
// {"level":30,"time":1596313323107,"pid":63739,"hostname":"foo","msg":"a message","originalMsg":"mapped to originalMsg"}
```

@@ -112,6 +112,2 @@ 'use strict'

if (msg !== undefined) {
// If msg appears as a string and in the object, preserve it as "originalMsg"
if (obj[messageKey] !== undefined) {
obj.originalMsg = obj[messageKey]
}
obj[messageKey] = msg

@@ -118,0 +114,0 @@ }

{
"name": "pino",
"version": "6.4.1",
"version": "6.5.0",
"description": "super fast, all natural json logger",

@@ -5,0 +5,0 @@ "main": "pino.js",

@@ -144,3 +144,2 @@ 'use strict'

msg: 'string',
originalMsg: 'object',
hello: 'world'

@@ -147,0 +146,0 @@ })

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc