Allow setting customPrettifiers from the cli
jedahan opened this issue · 2 comments
jedahan commented
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
tommiv commented
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')
}
}