Closed alexcroox closed 2 years ago
Your implementation of logMethod
is likely incorrect.
I would try something like:
logMethod(args, method) {
if (args.length === 2 && typeof args[0] === 'string') {
args[0] = `${args[0]} %j`
}
method.apply(this, args)
}
ah much better, thank you!!
I'm using a custom hook in order to add 2 param support to pino like I'm used to with console log, e.g
log.info('message', data)
I've modified the logMethod hook to support this:
However this is now interferring with pino-pretty and I get the following output from it:
[07:42:19.974] INFO: [object Object] 'incoming request'
What's the best approach to re-supporting pino-pretty's format? Is there a way to detect in the logMethod if pino-pretty is the initiator?