1

I am trying to integrate pino logger with nextjs application. This application requires to write two log files based on level- info and error. It should transform data before writing information in the log file. I tried something below but it didn't work:

 module.exports = pino({
  level: 'info', 
  transport: {
    pipeline: [
      {target: './info-transform-transport.mjs'},
      {target: 'pino/file',level: 'info', options: {destination: './logs/info.log',}},  
    ],
    pipeline: [
      {target: './error-transform-transport.mjs'},
      {target: 'pino/file',level: 'error', options: {destination: './logs/error.log',}},   
    ]
  },
})

Above code is only writing in the error log file. There is no data in info log file and error log file has data for both level - info and error.

Pipeline provides a way to transform the data before sending it to the stream but it looks like there could be only one pipeline. Is there anyway to achieve this functionality?

Himanshu
  • 11
  • 3

0 Answers0