+4
-4
@@ -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 @@ |
+32
-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"} | ||
| ``` |
+0
-4
@@ -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 @@ } |
+1
-1
| { | ||
| "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 @@ }) |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
307647
0.28%7160
-0.07%