-
Notifications
You must be signed in to change notification settings - Fork 245
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
Fix handling of slog logs before logging initialized #707
Conversation
…ogger is initialized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! This is my last round of feedback, should be good to go after this
Made the changes, also good for pushing to use the default slogtest. I have to add a little hack but it works and is much cleaner. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
* add handlers * Add support for handling slog style logging that happens BEFORE the logger is initialized. * Update changelog * unexport deferred handler * clean up and add tests * refactor tests * fix refactor misname * fix test * cleanup changes * Use slog tests. * Remove DeferredHandler from Logger and always use a wrapped deferred handler. * pr feedback * Add more support for logging
PR Description
Previously if you tried to use the logger for a slog style logger the system would panic. This adds a deferred handler for handling slog entries. The log buffer now supports normal logs and slog.Records and replays them in the appropriate order.
This is a lot of code to handle replaying of logs, its possible I could merge the deferred handler and the handler but then I think the logic would get real complicated.
PR Checklist