Add ANSI color mode

This commit is contained in:
Nanaloveyuki
2026-05-10 14:33:49 +08:00
parent 1d75f21671
commit 90af009e93
8 changed files with 136 additions and 15 deletions
+25
View File
@@ -0,0 +1,25 @@
## BitLogger Update Changes
version 0.4.0
### Feature
- feat: add `ColorMode = Never | Auto | Always` for text formatter color control
- feat: add ANSI level, target, timestamp, and field rendering to `format_text(...)`
- feat: add `color_mode` to `TextFormatter` and `TextFormatterConfig`
- feat: support `text_formatter.color_mode` in JSON config parsing and serialization
### Test
- test: cover ANSI text formatter rendering in `Always` mode
- test: cover `Auto` mode fallback behavior when `NO_COLOR` is present
- test: cover config parsing and serialization for `color_mode`
### Example
- docs: add `color_mode` usage examples to formatter documentation
### Notes
- `Auto` currently uses a conservative rule: if `NO_COLOR` exists, ANSI is disabled; otherwise ANSI is enabled
- this batch only covers ANSI formatter output and does not yet include inline style markup or tag registry support