pinojs/pino

multistream is not a function on browser.

Open

#1,686 建立於 2023年4月10日

在 GitHub 查看
 (1 留言) (3 反應) (0 負責人)JavaScript (13,157 star) (839 fork)batch import
enhancementhelp wanted

描述

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({})

貢獻者指南