I am sharing this as I struggled to get a pino logger to write to both STDOUT and a log file:
const dest = new stream.PassThrough();
dest.pipe(process.stdout);
dest.pipe(fs.createWriteStream('/logs/file.log', { flags: 'a' }));
const logger = pino({ level: 'info' }, dest);
As this appears very low level, I wonder if this is the right way to do this.