pinojs/pino

multistream is not a function on browser.

Open

#1,686 opened on 2023年4月10日

GitHub で見る
 (1 comment) (3 reactions) (0 assignees)JavaScript (13,157 stars) (839 forks)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({})

コントリビューターガイド