-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pino-pretty breaks flushing of stdout #279
Comments
The workaround is to save the end function and reassign it after pino-pretty is initialized: const end = destination.end
logger = pino(config, createPrettyDestination(destination, colorize))
destination.end = end |
I agree, this should be removed from pino-pretty. |
Yep! Glad to. |
Wow, that was a tricky one to write a test for. It took awhile to figure out the minimum code in isolation to trigger the problem. It's pretty clear from the test that SonicBoom is doing the work here, so pino-pretty doesn't need to. |
Btw, I recognize that calling |
pino-pretty overrides the
end
function on the destination to bypass the call tofs.close
.In doing so, it breaks flushing. In other words, if there are messages in the buffer, they get dropped when the function emits the close event.
Since sonic-boom 2.4, the call to
fs.close
is now bypassed, yet the buffer is still flushed. Therefore, I think pino-pretty should remove this logic. Besides, the logic is incomplete anyway as it does not consider stderr.The text was updated successfully, but these errors were encountered: