Closed jsumners closed 2 years ago
As you can see in https://github.com/pinojs/pino/blob/f16c98d7d758fa96155996bbc7604e4eee600d79/lib/worker.js#L51, our implementation for transport uses pino.multistream()
, so anything that should be possible through it should be.
It's definitely possible that we should be passing through more options and make things more configurable.
One more note, don't use process.stderr
or process.stdout
in workers, they do not work as you would expect, i.e. they send data back to the main thread for being printed out. Use pino.destination
.
One more note, don't use
process.stderr
orprocess.stdout
in workers, they do not work as you would expect, i.e. they send data back to the main thread for being printed out. Usepino.destination
.
I figured that was a bug, was going to get to it later. Fixed (locally).
our implementation for transport uses
pino.multistream()
, so anything that should be possible through it should be.
Unfortunately, that doesn't seem to be the case. If you use the above logger sample with:
const log = require('./logger')
log.error('boom')
// Not clear if I need to add an `await once()` somewhere myself or not...
process.exit(1)
Add a breakpoint in the stderr
transport (on the .write
), run the test, and notice that the breakpoint does not get hit.
As you can see in https://getpino.io/#/docs/api?id=pinomultistreamoptions-gt-stream we need to pass a customLevel options to multistream
in https://github.com/pinojs/pino/blob/f16c98d7d758fa96155996bbc7604e4eee600d79/lib/worker.js#L51. We should pass it through as we it is around.
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.
But they are mutually exclusive. Situation: I'm working on adding
pino
to a CLI tool where error logs will be written tostderr
as straight messages (not ndjson), and program output will be written tostdout
through a custom level (value:100
), e.g.log.output(csv)
.First attempt is logging configuration like:
logger.js:
stderr.transport.mjs:
But we know that won't work because setting the base logger to
level: 100
will prevent anything from ever being sent to thestderr
transport. So we would consider using the multistream feature instead. Except, that won't work because we need our stream to be a transport.What do we think should be done to support such use cases?