How to use pino-transport in nodejs for logs.?

4.2k Views Asked by At
const pino = require('pino')
const transport = pino.transport({
  targets: [{
    level: 'info',
    target: 'pino-pretty' // must be installed separately
  }, {
    level: 'trace',
    target: 'pino/file',
    options: { destination: '/path/to/store/logs' }
  }]
})
pino(transport)

enter image description here

Why I am getting this error pino.transport is not a function...?

1

There are 1 best solutions below

0
On

It is because your project is using pino version 6.x.

Transports were introduced in v7.x or later