fix: reset color after tint.Attr for all levels#101
Merged
lmittmann merged 4 commits intolmittmann:mainfrom Feb 2, 2026
Merged
fix: reset color after tint.Attr for all levels#101lmittmann merged 4 commits intolmittmann:mainfrom
tint.Attr for all levels#101lmittmann merged 4 commits intolmittmann:mainfrom
Conversation
Owner
|
Thanks for raising this bug. Could you append a test-case to |
Contributor
Author
Done |
tint.Attr for all levels
Owner
|
thank's for the fix! |
FIL033
commented
Feb 2, 2026
Contributor
Author
FIL033
left a comment
There was a problem hiding this comment.
@lmittmann After changes, this test no longer verifies the fix for the linked issue #100 .
The original bug was related to incorrect handling of log levels below slog.LevelInfo (e.g., slog.LevelDebug). The current version of the test uses the Info level, which was not affected by the bug, so it no longer serves as a regression test for issue #100 .
Owner
|
🤦🏻♂️ fixed in ccd13bc. thanks for noticing. |
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.
Description
Fixes a bug where
tint.Attrused inReplaceAttrdoesn't reset ANSI colors for log levels belowslog.LevelInfo(e.g., DEBUG), causing the color to "bleed" into subsequent log parts like source location.Problem
When using
tint.AttrinReplaceAttrto colorize theslog.LevelKeyattribute, the color was not being properly reset for levels <slog.LevelInfo. This resulted in the source location and message also being colored instead of just the level text.Solution
Modified the condition in
appendTintLevelto reset color whencolor >= 0(i.e., when a custom color is applied viatint.Attr), regardless of the log level. Previously, color reset only happened forlevel >= slog.LevelInfo.Change:
Related Issue
Fixes the issue described in #100