Manoj Kumar
Manoj Kumar

Reputation: 201

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

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

Upvotes: 4

Views: 4756

Answers (1)

Leandro Medeiros
Leandro Medeiros

Reputation: 66

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

Transports were introduced in v7.x or later

Upvotes: 5

Related Questions