Repository navigation
Commit 7fcb8a2
middleware: document printPrettyStack and harden NoColor panic test (#1131)
* middleware: honour NoColor in defaultLogEntry.Panic
defaultLogEntry.Panic called PrintPrettyStack unconditionally, which
always used ANSI colour codes regardless of the DefaultLogFormatter's
NoColor field.
Add PrintPrettyStackColor(rvr, useColor bool) and thread the flag
through prettyStack.parse. PrintPrettyStack now delegates to it with
useColor=true so existing callers are unaffected. defaultLogEntry.Panic
passes l.useColor so the panic output respects the same flag that
controls the rest of the request log.
Fixes #1042
Signed-off-by: alliasgher <alliasgher123@gmail.com>
* middleware: keep color-aware stack printer unexported
Address review: only defaultLogEntry.Panic needs the useColor variant
and it lives in the same package, so PrintPrettyStackColor does not need
to be exported. Rename it to printPrettyStack; the public PrintPrettyStack
API is unchanged.
Signed-off-by: alliasgher <alliasgher123@gmail.com>
* middleware: harden TestRecovererNoColor to actually guard the regression
Force IsTTY=true so cW would emit ANSI codes if useColor were true.
Without it the assertion is a no-op on non-TTY runners (e.g. CI) and
passes even against the buggy code path. Supersedes #1061.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Signed-off-by: alliasgher <alliasgher123@gmail.com>
Co-authored-by: alliasgher <alliasgher123@gmail.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 878fe71 commit 7fcb8a2
2 files changed
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
58 | 61 | | |
59 | 62 | | |
60 | 63 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
49 | 56 | | |
50 | 57 | | |
51 | 58 | | |
| |||
0 commit comments