Add nestedKey property to pino config (#41974)

This commit is contained in:
Sander Bouwhuis
2020-01-30 13:17:21 -08:00
committed by GitHub
parent e9a1379b4b
commit 723e4e8201
2 changed files with 8 additions and 0 deletions
+4
View File
@@ -267,6 +267,10 @@ declare namespace P {
* The string key for the 'message' in the JSON object. Default: "msg".
*/
messageKey?: string;
/**
* The string key to place any logged object under.
*/
nestedKey?: string;
/**
* Enables pino.pretty. This is intended for non-production configurations. This may be set to a configuration
* object as outlined in http://getpino.io/#/docs/API?id=pretty. Default: `false`.
+4
View File
@@ -177,6 +177,10 @@ const withTimeFn = pino({
timestamp: pino.stdTimeFunctions.isoTime,
});
const withNestedKey = pino({
nestedKey: 'payload',
});
// Properties/types imported from pino-std-serializers
const wrappedErrSerializer = pino.stdSerializers.wrapErrorSerializer((err: pino.SerializedError) => {
return {...err, newProp: 'foo'};