Forward file sink helpers through configured logger

This commit is contained in:
Nanaloveyuki
2026-05-10 12:27:15 +08:00
parent 69967badfd
commit 7f4aa199ea
6 changed files with 103 additions and 0 deletions
+1
View File
@@ -207,6 +207,7 @@ if native_files_supported() {
- Supported keys include `min_level`, `target`, `timestamp`, `sink.kind`, `sink.path`, `sink.append`, `sink.auto_flush`, `sink.rotation`, `sink.text_formatter`, and `queue`.
- `sink.rotation` currently supports `max_bytes` and `max_backups` for basic size-based rotation and backup retention.
- `file_sink(...)` also exposes `reopen()`, `open_failures()`, `write_failures()`, `flush_failures()`, and `rotation_failures()` for basic observability.
- `ConfiguredLogger` built through `build_logger(...)` also exposes `file_reopen()` and the corresponding file failure counters, so config-driven file logging keeps a usable control surface.
- `sink.text_formatter.template` currently supports fixed tokens: `{timestamp}`, `{timestamp_ms}`, `{level}`, `{target}`, `{message}`, and `{fields}`.
- 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.
+3
View File
@@ -30,6 +30,7 @@ version 0.3.0
- feat: add `FileRotation`, `file_rotation(...)`, and size-based file rotation with retained backups for `file_sink(...)`
- feat: support `sink.rotation.max_bytes` and `sink.rotation.max_backups` in JSON logger config
- feat: add `FileSink::reopen()` and basic file sink failure counters via `open_failures()`, `write_failures()`, and `flush_failures()`
- feat: forward file sink reopen and failure-counter helpers through `RuntimeSink` and `ConfiguredLogger`
- feat: add `SplitSink`, `split_sink(...)`, and `split_by_level(...)` for routing records into different sinks by predicate or level
- feat: add `Logger::bind(...)` as an ergonomic context-binding alias and `fields(...)` helper for tuple-based field construction
@@ -44,6 +45,7 @@ version 0.3.0
- test: cover template-based formatter rendering and disabled token behavior
- test: cover file rotation config parsing, config roundtrip, and native rotation behavior
- test: cover file sink reopen behavior and backend-dependent failure counter paths
- test: cover config-built file logger reopen and failure-counter helper access
- test: cover split sink predicate routing and level-based routing behavior
- test: cover `bind(...)` context composition and `fields(...)` helper behavior
- test: add async logger lifecycle, config roundtrip, and batching/flush policy test seeds
@@ -59,6 +61,7 @@ version 0.3.0
- docs: update formatter examples to demonstrate template-based text rendering
- docs: update file sink examples to demonstrate rotation and backup retention
- docs: document file sink reopen and observability counters in README variants
- docs: clarify that config-built file loggers keep file control and observability helpers
- docs: add split sink examples for level-based routing
- docs: add `bind(...)` examples for reusable context binding
- docs: update root README and English README with async adapter notes and current scope