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

贡献者指南