Closed noweh closed 2 years ago
Hi @noweh.
This gave me some headaches.
First, I've tried to leverage pino builtin pipeline. Unfortunately, pino-pretty is not a transform stream, and can not be used this way.
Then I've tried to use pino-pretty's destination which can be any SonicBoom instance. As you know, pino-roll is a SonicBoom instance... but it can not be serialized using pino@7+ new paradigm for options
The final solution is a bit convoluted, but works as you expect:
First, create a file for your own transport. Let's say pino-pretty-roll.js
module.exports = async ({ prettyOptions, rollOptions }) =>
require('pino-pretty')({ ...prettyOptions, destination: await require('pino-roll')(rollOptions) })
Then, use it:
pino.transport({
target: './pino-pretty-roll.js',
options: {
prettyOptions: { /* options for pino pretty */ },
rollOptions: { /* options for pino roll */ }
}
})
Maybe @mcollina will know a better way.
Closing since Noweh "acknoledge" the suggested implementation
Hello! pino-roll looks good to me, but we are already using the "pino-pretty" and when we use both at the same time, pino-pretty doesn't seem to work:
Expected logs: [2022-06-04, 4:01:30.709 +0000 PM] INFO (8200 on DIGI-LAPW051): XXX.
Real Logs: {"level":30,"time":1649260890720,"pid":8200,"hostname":"DIGI-LAPW051","msg":"XXX."}
is it possible to use both at the same time? Thanks!