1
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...?

Manoj Kumar
  • 169
  • 1
  • 7
  • works for me. you should debug and check whats going on. Check pino version in package json. ƒ pino(...args) ... transport:ƒ transport(fullOptions) version:'7.6.4' – indolentdeveloper Mar 07 '22 at 22:04

1 Answers1

3

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

Transports were introduced in v7.x or later