Make file append mode observable and persistent

This commit is contained in:
Nanaloveyuki
2026-05-10 12:35:15 +08:00
parent 12730fded8
commit b6673c66e4
8 changed files with 48 additions and 6 deletions
+2 -1
View File
@@ -207,7 +207,8 @@ 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()`, `file_flush()`, `file_close()`, and the corresponding file failure counters, so config-driven file logging keeps a usable control surface.
- `file_sink(...)` also exposes `append_mode()`. Passing `append=...` to `reopen(...)` updates the current append policy used by later reopen calls.
- `ConfiguredLogger` built through `build_logger(...)` also exposes `file_reopen()`, `file_flush()`, `file_close()`, `file_append_mode()`, 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.