pinojs/pino

multistream is not a function on browser.

Aperta

#1686 aperta il 10 apr 2023

 (1 commento) (3 reazioni) (0 assegnatari)JavaScript (839 fork)batch import
enhancementhelp wanted

Metriche repository

Star
 (13.157 stelle)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

Problems

Thank you for nice library. I'm using pino in my Next.js project.

It seems that pino works on browser and server. But, are some functions not compatible for browser?

For instance, I use multistream on browser.

export const logger = pino({/* */}, pino.multistream([]))

But, it doen't work well with is not a function error.

useEffect(() => {
  // TypeError: pino__WEBPACK_IMPORTED_MODULE_0___default(...).multistream is not a function
  logger.info("hello")
}, [])

Here is my sample code. https://codesandbox.io/p/sandbox/nice-elbakyan-4f8nzp

Questions

Are you going to support pino.multistream on browser?

P.S.

I have workaround to avoid this. But I think it is not the best. I will wait for your nice solution!

const pino = typeof pino.multistream === "function"
  ? pino({/* */}, pino.multistream([]))
   : pino({})

Guida contributor