Add file sink reopen and failure counters

This commit is contained in:
Nanaloveyuki
2026-05-10 12:19:52 +08:00
parent a26ec6399c
commit 69967badfd
6 changed files with 105 additions and 11 deletions
+4
View File
@@ -29,6 +29,7 @@ version 0.3.0
- feat: support formatter tokens `{timestamp}`, `{timestamp_ms}`, `{level}`, `{target}`, `{message}`, and `{fields}` in both runtime and JSON config paths
- 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: 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
@@ -42,6 +43,7 @@ version 0.3.0
- test: cover dropped-count reporting for bounded config-built queue
- 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 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
@@ -56,6 +58,7 @@ version 0.3.0
- docs: update root README, English README, and Mooncake README with config usage notes
- 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: 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
@@ -66,5 +69,6 @@ version 0.3.0
- current config scope is still intentionally constrained to stable built-in sink shapes
- formatter templates are intentionally limited to simple token replacement and do not yet include conditional blocks or alignment/padding controls
- current file rotation scope is intentionally limited to size-based rename retention and does not yet include time rotation or compression
- file sink observability is currently counter-based and explicit; it does not yet attempt automatic recovery or background self-healing
- queue wrapping remains synchronous drain-based delivery, not async runtime scheduling
- async logging remains an isolated adapter layer and currently targets `native/llvm` only