Centralize logger level wrapper registration#6752
Merged
Merged
Conversation
Copilot
AI
changed the title
[WIP] Fix duplicate logger level function boilerplate
Centralize logger level wrapper registration
May 30, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR centralizes the logger package’s repeated Info/Warn/Error/Debug closure wiring while preserving the existing exported logging APIs.
Changes:
- Added shared helper structs/constructors for standard and server-scoped level loggers.
- Updated file, markdown, and server logger wrappers to dispatch through centralized helper-backed structs.
- Added focused tests verifying helper constructors bind the expected
LogLevelvalues.
Show a summary per file
| File | Description |
|---|---|
internal/logger/common.go |
Adds centralized level logger helper types and constructors. |
internal/logger/file_logger.go |
Replaces per-level file logger closures with fileLevelLoggers. |
internal/logger/markdown_logger.go |
Replaces per-level markdown logger closures with markdownLevelLoggers. |
internal/logger/server_file_logger.go |
Replaces per-level server logger closures with serverLevelLoggers. |
internal/logger/log_level_wrappers_test.go |
Adds tests for centralized helper level bindings. |
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 May 30, 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 repeated the same
Info/Warn/Error/Debuglevel-binding boilerplate across the unified, markdown, and server logger variants. This change pulls the per-level closure registration into shared helpers while preserving the existing exported logging APIs.What changed
internal/logger/common.gofor:logInfo/logWarn/logError/logDebugvar blocks with a single helper-backed struct per logger type.Affected logger APIs
fileLevelLoggersmarkdownLevelLoggersserverLevelLoggersBehavioral scope
LogInfo/LogWarn/LogError/LogDebugLogInfoToMarkdown/...LogInfoToServer/...Test coverage
LogLevelbindings.