Reputation: 201
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)
Why I am getting this error pino.transport is not a function...?
Upvotes: 4
Views: 4756
Reputation: 66
It is because your project is using pino version 6.x.
Transports were introduced in v7.x or later
Upvotes: 5