Refactor logger sink wrappers to share level-based dispatch - #9700
Merged
Conversation
Closed
6 tasks
Copilot
AI
changed the title
[WIP] Refactor duplicate logging functions to reduce code duplication
Refactor logger sink wrappers to share level-based dispatch
Jul 20, 2026
lpcox
marked this pull request as ready for review
July 20, 2026 15:02
Contributor
There was a problem hiding this comment.
Pull request overview
Centralizes file and markdown logger dispatch while preserving public APIs and existing dual-write behavior.
Changes:
- Adds reusable level-based sink adapters and ordered fan-out.
- Refactors file and markdown wrappers to use shared dispatch.
- Adds dispatcher coverage and updates documentation.
Show a summary per file
| File | Description |
|---|---|
internal/logger/global_state.go |
Adds shared sink abstraction and dispatcher. |
internal/logger/file_logger.go |
Routes file logging through shared dispatch. |
internal/logger/markdown_logger.go |
Shares file/markdown fan-out logic. |
internal/logger/helper_functions_test.go |
Tests ordered multi-sink dispatch and nil handling. |
internal/logger/doc.go |
Documents centralized dispatch. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 5/5 changed files
- Comments generated: 0
- Review effort level: Medium
This was referenced Jul 20, 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 parallel
LogXxxandLogXxxToMarkdownwrapper families with the same per-level delegation shape, which made sink changes fan out across multiple files. This change keeps the public logging APIs intact while centralizing file/markdown dispatch behind shared sink helpers.Shared sink dispatch
internal/logger/global_state.go.File and markdown wrappers
logWithLevelto dispatch through the shared sink helper instead of owning its own global logger access path.logWithMarkdownto use the same dispatcher for unified-file + markdown fan-out.Behavior preserved
LogInfo,LogWarn,LogInfoToMarkdown, andLogWarnToMarkdownremain unchanged.Focused coverage