Skip to content

fix(recovery): honor console color configuration - #4917

Open
RubenPari wants to merge 1 commit into
gin-gonic:masterfrom
RubenPari:fix/recovery-console-color
Open

RubenPari wants to merge 1 commit into
gin-gonic:masterfrom
RubenPari:fix/recovery-console-color

Conversation

@RubenPari

Copy link
Copy Markdown
Contributor

Summary

  • Apply Logger terminal detection and console color settings to Recovery, including TERM=dumb and sequential mode changes.
  • Synchronize prefix updates with log writes while preserving stack frames and existing recovery behavior.
  • Add regression tests for color modes, broken pipes, nil writers, credential masking, and concurrent panics.

Fixes #2505

Validation

  • go test ./...
  • go test -race .
  • go test -race -run 'Test(Recovery|TerminalColorDetection|IsOutputColor)' -count=10 .
  • make test
  • make vet
  • go build ./...
  • gofmt -s -d logger.go logger_test.go recovery.go recovery_test.go

make fmt-check reports pre-existing formatting in binding/binding_nomsgpack.go on the base branch. golangci-lint was unavailable locally.

@codecov

codecov Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.65%. Comparing base (0f09c3a) to head (a5b6466).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4917   +/-   ##
=======================================
  Coverage   98.65%   98.65%           
=======================================
  Files          48       48           
  Lines        3188     3206   +18     
=======================================
+ Hits         3145     3163   +18     
  Misses         43       43           
Flag Coverage Δ
--ldflags="-checklinkname=0" -tags sonic 98.64% <100.00%> (+<0.01%) ⬆️
-tags go_json 98.58% <100.00%> (+<0.01%) ⬆️
-tags nomsgpack 98.63% <100.00%> (+<0.01%) ⬆️
go-1.26 98.34% <100.00%> (+<0.01%) ⬆️
go-1.27 98.67% <100.00%> (+<0.01%) ⬆️
macos-latest 98.65% <100.00%> (+<0.01%) ⬆️
ubuntu-latest 98.65% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Recovery middleware does not obey gin.DisableConsoleColor()

1 participant