Open jedahan opened 3 months ago
I think it should be possible via the use of a config file: https://github.com/pinojs/pino-pretty/blob/77e85fdcf3413b5064c5258ea3b858eac230340f/bin.js#L23.
Came here with the same question and just checked it out. It does work indeed. Here's how I "deserialize" a JS stacktrace which is hard to read otherwise:
// pino-pretty.config.js
module.exports = {
timestampKey: 'ts',
messageKey: 'message',
ignore: 'type,serviceName',
customPrettifiers: {
trace: (trace) => '\n' + trace.replace(/\\n/g, '\n')
}
}
I like that our logging code does not need to care if its being pretty-printed or not, just adding
| pretty-print
to our dev scripts is good separation.I would like to customize how our objects are pretty-printed, like
customPrettifiers
work. Is there a way to tell pino-pretty cli to load customPrettifiers from a file? Would this be a desired feature? Do you have tips on how to start implementing said feature?Thanks