Skip to content

Replace owned handlers when logging is configured again - #5

Merged
ctoth merged 1 commit into
masterfrom
improve/repeated-setup
Oct 29, 2026
Merged

ctoth merged 1 commit into
masterfrom
improve/repeated-setup

Conversation

@ctoth

@ctoth ctoth commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

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.

@ctoth
ctoth force-pushed the improve/atomic-initialization branch from 87875c3 to c1ab023 Compare October 29, 2026 18:31
@ctoth
ctoth force-pushed the improve/repeated-setup branch from fd702a3 to aea9a8c Compare October 29, 2026 18:31
@ctoth
ctoth changed the base branch from improve/atomic-initialization to master October 29, 2026 18:31
@ctoth
ctoth force-pushed the improve/repeated-setup branch from aea9a8c to b0addc9 Compare October 29, 2026 18:41
@ctoth
ctoth force-pushed the improve/repeated-setup branch from b0addc9 to ecc4e25 Compare October 29, 2026 18:41
@ctoth
ctoth merged commit 1610c62 into master Oct 29, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant