feat: add logger middleware config migrator for Output -> Stream rename#269
Conversation
Add v3 migration that renames the `Output` config field to `Stream` in logger.Config blocks, matching the Fiber v3 API change. https://claude.ai/code/session_01TAwsCfCgeoqqyf3gQuG2Xa
Summary of ChangesHello @ReneWerner87, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a crucial migration script for Fiber v3, addressing an API change in the logger middleware. The script automates the renaming of the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
The pull request adds a migration to rename the Output field to Stream in logger.Config blocks. The implementation is a good start, but it has some potential issues with correctness and robustness. The regex used is too simple and doesn't handle package aliases or whitespace. More importantly, the string replacement logic is not safe and could lead to unintended changes in user code. I've left specific comments with details on these issues and suggested adding more comprehensive test cases to cover these scenarios.
WalkthroughAdds a v3 migration that locates Fiber logger.Config usages and rewrites configs by replacing the deprecated Changes
Sequence Diagram(s)sequenceDiagram
participant CLI as CLI (cobra.Command)
participant Migr as MigrateLoggerConfig
participant Parser as IterateConfigBlocks
participant FS as ChangeFileContent / FileSystem
CLI->>Migr: invoke migration (cwd, versions)
Migr->>Parser: scan files for Fiber logger imports/aliases
Parser->>Migr: return matching config blocks
Migr->>FS: apply rewritten file contents
FS-->>Migr: success / error
Migr-->>CLI: print log and return result
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🧰 Additional context used🧬 Code graph analysis (2)cmd/internal/migrations/v3/logger_config.go (2)
cmd/internal/migrations/v3/logger_config_test.go (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
🔇 Additional comments (6)
✏️ Tip: You can disable this entire section by setting Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Adds a new Fiber v3 migration step to update logger middleware configuration to match the Output → Stream field rename, and wires it into the v3 migration run.
Changes:
- Introduce
MigrateLoggerConfigto rewritelogger.Config{...}blocks fromOutput:toStream: - Add unit tests covering basic, no-op, and multi-field cases
- Register the new migration in the v3 migration function list
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| cmd/internal/migrations/v3/logger_config.go | New migration that updates logger.Config field name Output → Stream. |
| cmd/internal/migrations/v3/logger_config_test.go | Tests validating that logger config blocks are rewritten and that no-op runs are silent. |
| cmd/internal/migrations/lists.go | Adds MigrateLoggerConfig to the v3 migration pipeline. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Use package-level compiled regexes instead of per-call compilation - Support aliased logger imports via collectAliases helper - Handle whitespace between Config and opening brace - Use positional regex to only rename Output field assignments, not Output: occurrences inside string literals (e.g. Format field) - Add tests for alias imports, string literal safety, whitespace, and single-line config blocks https://claude.ai/code/session_01TAwsCfCgeoqqyf3gQuG2Xa
Add v3 migration that renames the
Outputconfig field toStreamin logger.Config blocks, matching the Fiber v3 API change.
https://claude.ai/code/session_01TAwsCfCgeoqqyf3gQuG2Xa
Summary by CodeRabbit