Skip to content

feat: add logger middleware config migrator for Output -> Stream rename#269

Merged
ReneWerner87 merged 2 commits intomasterfrom
claude/logger-middleware-migrator-v3-mVvvD
Feb 7, 2026
Merged

feat: add logger middleware config migrator for Output -> Stream rename#269
ReneWerner87 merged 2 commits intomasterfrom
claude/logger-middleware-migrator-v3-mVvvD

Conversation

@ReneWerner87
Copy link
Member

@ReneWerner87 ReneWerner87 commented Feb 6, 2026

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 by CodeRabbit

  • Chores
    • Added automatic logger configuration migration for upgrades from v2.x to <4.0.0, converting legacy Output fields to the new Stream format while preserving other logger settings.
  • Tests
    • Expanded test coverage for the logger migration across multiple scenarios (aliases, formatting variations, inline and multi-field configs, and no-op cases).

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
@ReneWerner87 ReneWerner87 requested a review from a team as a code owner February 6, 2026 17:28
@ReneWerner87 ReneWerner87 requested review from Copilot, efectn, gaby and sixcolors and removed request for a team February 6, 2026 17:28
@github-actions github-actions bot added the ✏️ Feature New feature or request label Feb 6, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @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 Output configuration field to Stream within logger.Config blocks, ensuring that existing applications can be updated to Fiber v3 without manual modification of these specific logger configurations. This change streamlines the upgrade path and maintains compatibility with the new Fiber v3 API.

Highlights

  • New Migration Added: A new migration, MigrateLoggerConfig, has been introduced to facilitate upgrades to Fiber v3.
  • Logger Config Field Rename: This migration specifically renames the Output configuration field to Stream within logger.Config blocks, aligning with an API change in Fiber v3.
  • Automated Code Transformation: The migration automatically identifies and updates relevant code sections, reducing manual effort during the upgrade process.

🧠 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
  • cmd/internal/migrations/lists.go
    • Added v3migrations.MigrateLoggerConfig to the list of v3 migrations, ensuring it runs as part of the upgrade process.
  • cmd/internal/migrations/v3/logger_config.go
    • New file containing the MigrateLoggerConfig function.
    • This function uses regular expressions to find logger.Config blocks and replaces all occurrences of Output: with Stream: within them.
  • cmd/internal/migrations/v3/logger_config_test.go
    • New file containing unit tests for MigrateLoggerConfig.
    • Tests cover successful renaming of Output to Stream, handling of files without the Output field (no-op), and correct processing of logger.Config blocks with multiple fields.
Activity
  • No specific review comments or discussions have been recorded yet for this pull request.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@coderabbitai
Copy link

coderabbitai bot commented Feb 6, 2026

Walkthrough

Adds a v3 migration that locates Fiber logger.Config usages and rewrites configs by replacing the deprecated Output: field with Stream:; the migration is registered and covered by new tests.

Changes

Cohort / File(s) Summary
Migration registry
cmd/internal/migrations/lists.go
Register new MigrateLoggerConfig in the v3 migrations list (range >=2.0.0-0 to <4.0.0-0).
Logger migration implementation
cmd/internal/migrations/v3/logger_config.go
New MigrateLoggerConfig scanning imports/aliases for Fiber logger, iterating logger.Config blocks, replacing Output: with Stream:, and applying edits via ChangeFileContent.
Tests
cmd/internal/migrations/v3/logger_config_test.go
Comprehensive tests covering multiple formatting cases, aliases, single-line configs, no-change scenarios, and string-literal avoidance.

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
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • gaby
  • sixcolors
  • efectn

Poem

🐰
I nibbled through imports at night,
Found Output hiding out of sight,
I hopped and swapped it to Stream with glee,
Now logger configs hum—hoppity, whee! 🥕

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The description explains the change (Output to Stream rename) and references the Fiber v3 API change, but lacks details on problem context and uses a vague reference link instead of inline explanation. Expand the description to explicitly explain why this change is needed (e.g., Fiber v3 API migration requirement) and provide inline context instead of relying on an external session link.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding a logger middleware config migrator that renames Output to Stream, which aligns with the PR's primary objective.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch claude/logger-middleware-migrator-v3-mVvvD

No actionable comments were generated in the recent review. 🎉

🧹 Recent nitpick comments
cmd/internal/migrations/v3/logger_config.go (1)

25-30: Regex compiled per file per alias — acceptable for a migration tool, but worth noting.

regexp.MustCompile on line 26 runs inside the ChangeFileContent callback, so it's invoked for every .go file × every alias. For a one-shot migration tool this is fine, but if reuse is ever a concern, consider caching compiled patterns by alias.

cmd/internal/migrations/v3/logger_config_test.go (1)

19-19: Nit: Prefer assert or plain error ignoring over require in deferred cleanup.

require.NoError calls t.FailNow() (→ runtime.Goexit()), which in a defer can mask the original test failure. Consider _ = os.RemoveAll(dir) or assert.NoError for cleanup — the temp directory will be cleaned up by the OS anyway.

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 729628b and e218d5c.

📒 Files selected for processing (2)
  • cmd/internal/migrations/v3/logger_config.go
  • cmd/internal/migrations/v3/logger_config_test.go
🧰 Additional context used
🧬 Code graph analysis (2)
cmd/internal/migrations/v3/logger_config.go (2)
cmd/internal/helpers.go (1)
  • ChangeFileContent (54-110)
cmd/internal/migrations/v3/common.go (1)
  • IterateConfigBlocks (629-655)
cmd/internal/migrations/v3/logger_config_test.go (1)
cmd/internal/migrations/v3/logger_config.go (1)
  • MigrateLoggerConfig (18-43)
⏰ 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)
  • GitHub Check: Build (1.25.x, macos-latest)
  • GitHub Check: Build (1.25.x, windows-latest)
  • GitHub Check: Build (1.25.x, ubuntu-latest)
🔇 Additional comments (6)
cmd/internal/migrations/v3/logger_config.go (2)

13-16: LGTM on package-level compiled regexes.

Good practice compiling these at package level. The reLoggerOutputField pattern correctly avoids matching Output inside string literals by requiring the preceding character to be {, \n, or start-of-string.


34-42: LGTM on error handling and output.

Clean error wrapping and the early-return on no-change is consistent with the other migration functions.

cmd/internal/migrations/v3/logger_config_test.go (4)

14-38: Good test coverage for the basic migration case.

The test correctly verifies Output:Stream: rename, absence of Output:, and the migration log message.


88-113: Valuable test for string-literal safety.

This is an important edge case. The assertion on line 111 properly verifies that "Output: ${status}\n" inside the Format string is not modified while the actual Output: field is renamed.


140-163: LGTM on alias import test.

Good coverage ensuring aliased imports (fiberlog) are handled correctly.


165-186: LGTM on single-line config test.

Covers the {Output: os.Stdout} inline pattern where { is the preceding character rather than \n.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Fiber v3 migration step to update logger middleware configuration to match the OutputStream field rename, and wires it into the v3 migration run.

Changes:

  • Introduce MigrateLoggerConfig to rewrite logger.Config{...} blocks from Output: to Stream:
  • 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 OutputStream.
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
@ReneWerner87 ReneWerner87 merged commit 53bba68 into master Feb 7, 2026
14 checks passed
@ReneWerner87 ReneWerner87 deleted the claude/logger-middleware-migrator-v3-mVvvD branch February 7, 2026 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✏️ Feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants