Closed MrEmanuel closed 1 year ago
A possible solution for me is to only use pino
in production, thus eliminating my need to config.transport
to get the pretty print functionality.
I just remove config.transport
and add the following to my pino-logger/overrideLogger.js
if (process.env.NODE_ENV === "production") {
override()
}
But it would be nice to use it in development too.
This look like a very interesting situation to investigate. However I would hardly have time for this :(. I would be happy to accept a PR.
I would be happy to investigate, but I don't know where to begin unfortunately. If you could give me some tips, I could look in to it. Otherwise it's totally fine to close the issue. :)
My current workaround is to only use pino in production because then I don't need the transport property.
Closing then.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
As I guess many people do, I'm trying to override the standard
console
methods. It works great when I import or require my wrapper, but when I try to preload it, my app runs wild on CPU resources.I've narrowed it down to have something to do with
config.transport
. I don't understand how workers function, and I don't understand much about preloading node modules and node's lifecycle, but it makes sense that something's wrong then trying to preload a module that start a worker. Maybe someone here can help me figure out how to get it working, if it's even possible?What seems to happen is that my package, where I import and set up
pino
, gets called repeatedly. If I print "test" in my index file, where I setup pino I get a wall of "test" messages filling my terminal.Here's my test example. Run
npm start
to see the issue. When I comment outpinoConfig.transport
the error goes away.package.json
index.js
/pino-logger/index.js
/pino-logger/overrideLogger.js
/pino-logger/package.json
Help is much appreciated. Thanks! :)