pinojs/pino

multistream is not a function on browser.

開放

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

 (1 則留言) (3 個反應) (0 位負責人)JavaScript (839 個分叉)batch import
enhancementhelp wanted

倉庫指標

星標
 (13,157 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

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

貢獻者指南