When not using the nestedKey Pino option, it's hard to figure a way to custom pretty the value log based on coming keys, by example using util.inspect():
customPrettifiers: {
//when using a nestedKey option key like 'payload' its easy to perform visual changes, but when log merge the values it's not.
payload(value) {
return util.inspect(value, {
depth: null,
breakLength: 4,
colors: true
});
},
//A custom wildcard for any other non-setted keys can be useful
'*'(value) {
return util.inspect(value, {
depth: null,
breakLength: 4,
colors: true
});
},
},
//Expect foo and other keys to be auto inspected by '*' callback:
logger.info({foo: {bar: {zoo: -1}}});
When not using the
nestedKey
Pino option, it's hard to figure a way to custom pretty the value log based on coming keys, by example using util.inspect():