Next.js Discord

Discord Forum

Pino Nextjs

Unanswered
Transvaal lion posted this in #help-forum
Open in Discord
Transvaal lionOP
i want to use pino in my application and i want to create a file where i store all the logs
i did this for now in my logger.js file :
import pino from 'pino'

const pinoConfig = {
  browser: {
    asObject: true
  }
} 
const transport = pino.transport({
  target: './next'
})
pino(transport)
const logger = pino(pinoConfig)

export const log = msg => logger.info(msg)
export default logger

i created a file next.log where i should be storing all my logs
i am getting the error of " unable to determine transport target for "./next" "

alternatively i tried making the absolute path of the file and i got another error :"TypeError: pinoWEBPACK_IMPORTED_MODULE0default(...).transport is not a function"

3 Replies

Try import ‘./next’
Transvaal lionOP
my supervisor just decided to drop down the idea...but i will make sure to try it home