I have this logger model:
LoggerModule.forRootAsync({
imports: [ConfigModule],
useFactory: (configService: ConfigService<AppConfig, true>) => ({
pinoHttp: {
level: configService.get('logger.level', { infer: true }),
autoLogging: false,
name: 'someName',
messageKey: 'message', // take advantage Datadog's default facet
mixin(): Record<string, unknown> {
return {
dd: { ...getDatadogMixin(tracer) },
};
},
nestedKey: 'metadata',
reqCustomProps(req) {
return {
executionId: req.headers[EXECUTION_ID],
};
},
},
}),
inject: [ConfigService],
}),
I know that as of pino 7.x, when the mixin is used with the nestedKey
option, the object returned from the mixin method will also be nested.
I'm trying to revert that, which means that I want the object that returning from the mixin method would still be at the root.
{"level":30,"time":1591195061437,"pid":16012,"hostname":"x", dd: {<dd-tracing-object>}, "metadata":
{"executionId":"12345"},"msg":"Message 1"}
tnx.