Add nestedKey property to pino config (#41974)

This commit is contained in:
Sander Bouwhuis 2020-01-30 22:17:22 +01:00 committed by GitHub
parent e9a1379b4b
commit 723e4e8201
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

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`.

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'};