Deduplicate logger startup and shutdown wiring with shared registries#7575
Merged
Conversation
Copilot
AI
changed the title
[WIP] Refactor logger initialization to remove duplicate code
Deduplicate logger startup and shutdown wiring with shared registries
Jun 15, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors internal/logger startup/shutdown orchestration by centralizing the “which loggers participate, and in what order” logic into shared registries, while preserving the existing per-logger Init*/Close* public APIs and non-fatal startup warning behavior.
Changes:
- Introduces shared gateway/proxy initializer registries and a global closer registry, plus small helpers to iterate them.
- Replaces hand-written sequences in
InitGatewayLoggers,InitProxyLoggers, andCloseAllLoggerswith registry iteration. - Adds tests to assert registry membership and ordering; updates package documentation to describe the registry model.
Show a summary per file
| File | Description |
|---|---|
| internal/logger/registry.go | Adds the shared initializer/closer registries and iteration helpers. |
| internal/logger/init.go | Switches gateway/proxy initialization to use the shared registries. |
| internal/logger/init_test.go | Adds tests asserting registry membership and ordering. |
| internal/logger/global_helpers.go | Switches CloseAllLoggers to use the shared closer registry. |
| internal/logger/common.go | Updates package documentation to describe the registry-based orchestration model. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 5/5 changed files
- Comments generated: 0
This was referenced Jun 15, 2026
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.
The logger package had repeated startup/shutdown glue across five logger types: per-type global init/close wrappers were already backed by shared generic helpers, but gateway/proxy startup and
CloseAllLoggersstill relied on manually duplicated wiring. This change centralizes that orchestration without changing the public logger APIs or fallback behavior.What changed
InitGatewayLoggers,InitProxyLoggers, andCloseAllLoggerswith registry iteration.Why this is smaller and safer
Init*/Close*entry points intact.Package docs and coverage
Shape of the refactor