-
Notifications
You must be signed in to change notification settings - Fork 888
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Multistream resets logLevel to 30, logging trace and debug is not possible #1617
Comments
Have you consulted the documentation? https://getpino.io/#/docs/api?id=pino-multistream |
Documentation says to set level on the lowest level, as done in the example |
Have you tried it without the |
Yes and they also don't work. See: import pino from 'pino'
const logger = pino({ level: 'trace' }, pino.multistream([
{ stream: process.stdout }
])
)
const message = 'TEST'
//These will work
logger.info(message)
logger.warn(message)
logger.error(message)
logger.fatal(message)
// These will not work
logger.trace(message)
logger.debug(message)
const message2 = 'HELLO'
const loggerWithoutMultistream = pino({ level: 'trace' }, process.stdout)
// These will now work
loggerWithoutMultistream.trace(message2)
loggerWithoutMultistream.debug(message2) |
You need to set a |
I have tried the example in the docs and the debug log message didn't print out on stdout. Would be nice to have a test for this later on.
I have played around with it a bit and solution is to set It is said in the docs not so clearly just above this example: "In order for multistream to work, the log level must be set to the lowest level used in the streams array." So correct example is this:
|
Ran into this issue myself too. Confused why |
https://github.com/pinojs/pino/blob/master/lib/multistream.js#L112 Yeah the default level is |
@Raynos if you have any improvements to clarify this it would be awesome. |
Hi,
I have encountered an issue with logging using a pino multistream.
Using a multistream, somehow disables the info and trace method, as the minimum value is set to 30 (corresponding to info). Any pino options and minimum Level Option in the Stream are discarded. Creating individual loggers without a Multistream, works fine.
Reference as code:
When printing the object, the Multistream seems to edit minLevel in each individual Stream to 30, and set the pino.levelVal to 30 as well.
The text was updated successfully, but these errors were encountered: