Files
2026-05-08 16:24:51 +08:00

48 lines
3.2 KiB
Markdown

## BitLogger Update Changes
version 0.2.0
### Feature
- feat: add `BufferedSink[S]` with in-memory buffering support
- feat: add `buffered_sink(...)` constructor with configurable `flush_limit`
- feat: add `BufferedSink::flush()` for manual drain
- feat: add `BufferedSink::pending_count()` for buffer inspection in tests and integration code
- feat: add `FilterSink[S]` for predicate-based record filtering
- feat: add `filter_sink(...)` constructor for composable sink routing
- feat: add `Logger::with_filter(...)` as a higher-level chained filter entry point
- feat: add reusable filter helpers such as `target_is(...)`, `target_has_prefix(...)`, `message_contains(...)`, `level_at_least(...)`, `has_field(...)`, and `field_equals(...)`
- feat: add predicate combinators `all_of(...)`, `any_of(...)`, and `not_(...)`
- feat: add `PatchSink[S]`, `patch_sink(...)`, and `Logger::with_patch(...)` for record transformation
- feat: add record patch helpers such as `prefix_message(...)`, `set_target(...)`, `append_fields(...)`, `redact_field(...)`, `redact_fields(...)`, and `compose_patches(...)`
- feat: add `QueuedSink[S]`, `queued_sink(...)`, and `Logger::with_queue(...)` for explicit queued delivery
- feat: add `QueueOverflowPolicy` with `DropNewest` and `DropOldest` bounded-backlog strategies
- feat: add configurable text formatter APIs `text_formatter(...)`, `format_text(...)`, and `format_json(...)`
- feat: add formatter-based sinks `formatted_console_sink(...)`, `text_console_sink(...)`, `formatted_callback_sink(...)`, and `text_callback_sink(...)`
- feat: add native-only `file_sink(...)` plus `native_files_supported()` backend capability detection
- feat: add explicit file sink lifecycle helpers `FileSink::is_available()`, `flush()`, and `close()`
### Test
- test: cover manual flush behavior for buffered sink
- test: cover auto flush when buffered records reach the configured limit
- test: cover predicate-based forwarding for filter sink
- test: cover chained `Logger::with_filter(...)` behavior with child target composition
- test: cover helper-based filter composition for target, level, message, and field matching
- test: cover record patch composition, target rewrite, message rewrite, field append, and field redaction
- test: cover queue drain order, bounded backlog drop behavior, and chained `Logger::with_queue(...)` usage
- test: cover formatter customization, formatter-only message mode, formatted callback output, and JSON formatter shape
- test: cover backend-aware file sink availability and lifecycle behavior
- test: keep callback-based composition validation with child target, context fields, and timestamp enabled
### Example
- docs: update `examples/basic` to demonstrate buffered sink usage
- docs: update `examples/basic` to demonstrate filter sink usage
- docs: update examples and README with helper-based chained logger filter usage
- docs: update examples and README with record patch usage for redaction and enrichment
- docs: update examples and README with explicit queued sink usage and overflow policy examples
- docs: update examples and README with configurable text formatter usage
- docs: update examples and README with native file sink usage and backend caveat
- docs: keep README focused on public usage and move change tracking to `docs/changes/`