Repository navigation
Replace owned handlers when logging is configured again - #5
Merged
Merged
Conversation
ctoth
force-pushed
the
improve/atomic-initialization
branch
from
October 29, 2026 18:31
87875c3 to
c1ab023
Compare
ctoth
force-pushed
the
improve/repeated-setup
branch
from
October 29, 2026 18:31
fd702a3 to
aea9a8c
Compare
ctoth
force-pushed
the
improve/repeated-setup
branch
from
October 29, 2026 18:41
aea9a8c to
b0addc9
Compare
ctoth
force-pushed
the
improve/repeated-setup
branch
from
October 29, 2026 18:41
b0addc9 to
ecc4e25
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Goal
Replace only this package's handlers on repeated logging setup.
State
Rebuilt on master after #2, #3, #4, #6 and #7 merged. Keep the root logger and existing helper API. After the staged replacement succeeds, detach and close the handlers this package installed previously.
Decisions and why
Builds on #4's staging: a failed setup closes its staged handlers and leaves installed handlers, root level and exception hook untouched, so this change needs no rollback code of its own. Fault handling uses #3's crashlogger state: a call that does not enable crash logging disables it before old streams close; a call that enables it has already retargeted it to the new stream. Track only owned handlers, preserve unrelated ones, and restore the previous exception hook when a repeat call or shutdown turns it off. Setup and shutdown run on the main thread.
Surprises
The earlier version of this PR duplicated #3's fault-handler tracking and #4's rollback; both were removed when rebuilding on merged master. Opening a file may still truncate its contents before a later failure.
Next step
Read the PR's package checks and merge. No release.