-
Notifications
You must be signed in to change notification settings - Fork 15
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
Support synchronous logging for proper exit handling #13
Comments
Thank you for raising this 👍 Do you have any idea which is the preferred Node API for implementing this? |
I don't think it needs a Node API, but needs to synchronously flush the logs or wait until all async writes are completed before returning. My workaround right now is to wait a few seconds and hope that all logs are flushed before exiting. setTimeout(() => {
process.exit(1);
}, 5000); |
Thanks for the follow-up. I think the origin of the sync requirement is because queued work (such as timeouts) won't be completed in certain process exit scenarios. I believe this is where the need for a synchronous request comes into the picture. |
Perhaps pino-seq should implement something like this: index.ts#L59 When winstonjs only provides a synchronous |
Hi all! Awaiting the logger's await logger.flush(); If you still run into any problems or incompatibilities with this please let me know; we'll close this because the codebase has changed drastically since the original issue report was received, and it's not clear that the same constraints/deficiencies still exist today. Thanks! |
Exit logging does not work on
pino-seq
which is crucial for production code. This causes important error logs to get lost on unhandled exceptions. When using exit handlers I get the following error:These issues pinojs/pino-pretty#37 and pinojs/pino#542 seem to be related. We need
seq-logging
to support synchronous requests for this to work so we can call it fromflushSync
implementation inpino-seq
and probably other implementors.The text was updated successfully, but these errors were encountered: