mirror of
https://github.com/Nanaloveyuki/BitLogger.git
synced 2026-05-30 15:42:25 +00:00
✨ Add scoped target and field style markup
This commit is contained in:
@@ -282,6 +282,7 @@ match logger.file_runtime_state() {
|
||||
- Supported keys include `min_level`, `target`, `timestamp`, `sink.kind`, `sink.path`, `sink.append`, `sink.auto_flush`, `sink.rotation`, `sink.text_formatter`, and `queue`.
|
||||
- `TextFormatter` and `TextFormatterConfig` now include `color_mode = Never | Auto | Always` for ANSI text coloring control.
|
||||
- `TextFormatter` and `TextFormatterConfig` also include `style_markup = disabled | builtin | full` so callers can choose whether style markup is parsed and whether custom tags are active.
|
||||
- `target_style_markup` and `fields_style_markup` independently control whether `target` and `fields` are parsed for style markup.
|
||||
- `message` also supports lightweight inline style tags such as `<red>...</>`, `<b>...</>`, `<#ff0000>...</>`, and `<bg:#202020>...</>`.
|
||||
- Builtin semantic tags now include `<accent>`, `<info>`, `<success>`, `<warning>`, `<danger>`, and `<muted>`.
|
||||
- Runtime style-tag APIs now include `TextStyle`, `StyleTagRegistry`, `style_tag_registry()`, `default_style_tag_registry()`, `set_tag(...)`, and `define_alias(...)`.
|
||||
@@ -313,7 +314,9 @@ match logger.file_runtime_state() {
|
||||
- `sink.text_formatter.template` currently supports fixed tokens: `{timestamp}`, `{timestamp_ms}`, `{level}`, `{target}`, `{message}`, and `{fields}`.
|
||||
- `sink.text_formatter.color_mode` currently supports `never`, `auto`, and `always`.
|
||||
- `sink.text_formatter.style_markup` currently supports `disabled`, `builtin`, and `full`.
|
||||
- `sink.text_formatter.target_style_markup` and `sink.text_formatter.fields_style_markup` currently support `disabled`, `builtin`, and `full`.
|
||||
- `sink.text_formatter.style_tags.<name>` currently supports `fg`, `bg`, `bold`, `dim`, `italic`, and `underline`.
|
||||
- `fields_style_markup` currently applies to field values only, not field keys.
|
||||
- Config-driven sink assembly currently supports `console`, `json_console`, `text_console`, and `file`.
|
||||
- `queue` remains a synchronous bounded wrapper around the final sink, not an async runtime.
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ version 0.4.0
|
||||
- feat: add `StyleMarkupMode = Disabled | Builtin | Full` plus formatter helpers so callers can explicitly disable style parsing or allow builtin-only parsing
|
||||
- feat: support `sink.text_formatter.style_markup` in JSON config parsing and serialization
|
||||
- feat: add builtin semantic style tags such as `accent`, `info`, `success`, `warning`, `danger`, and `muted`
|
||||
- feat: add independent `target_style_markup` and `fields_style_markup` controls for `TextFormatter` and `TextFormatterConfig`
|
||||
|
||||
### Test
|
||||
|
||||
@@ -29,6 +30,7 @@ version 0.4.0
|
||||
- test: cover formatter `style_tags` JSON parsing, config roundtrip, JSON helper export, and config-driven styled formatter rendering
|
||||
- test: cover disabled markup mode, builtin-only mode, and config-driven `style_markup` behavior
|
||||
- test: cover builtin semantic tag rendering and confirm user overrides still take precedence
|
||||
- test: cover target and field markup rendering, plus config roundtrip for the new formatter markup scopes
|
||||
|
||||
### Example
|
||||
|
||||
@@ -44,3 +46,4 @@ version 0.4.0
|
||||
- formatter-local tag lookup currently takes precedence over global tag lookup, and global lookup takes precedence over builtin tags
|
||||
- JSON config currently supports concrete style objects only; alias-style declarations remain runtime-only
|
||||
- users can now decide whether custom style parsing is enabled through runtime formatter APIs or `sink.text_formatter.style_markup`
|
||||
- `fields_style_markup` currently styles field values only and intentionally leaves field keys raw
|
||||
|
||||
Reference in New Issue
Block a user