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
+5 -2
View File
@@ -46,8 +46,8 @@ BitLogger 是一个基于 MoonBit 的结构化日志库。
- 支持 `parse_logger_config_text(...)``stringify_logger_config(...)` 进行最小 JSON 配置读写
- config-driven logger assembly via `build_logger(...)`
- 支持 `build_logger(...)` 将配置组装为可直接使用的 logger
- native-only file output via `file_sink(...)`, with basic size rotation and backup retention
- 支持 `file_sink(...)`、基础 size rotation backup retention,但当前仅保证 `native/llvm` backend 可用
- native-only file output via `file_sink(...)`, with basic size rotation, backup retention, explicit `reopen()`, and failure counters
- 支持 `file_sink(...)`、基础 size rotation / backup retention、显式 `reopen()` 与失败计数,但当前仅保证 `native/llvm` backend 可用
## Example / 示例
@@ -220,3 +220,6 @@ test {
- basic rotation is size-based / 当前基础轮转为按文件大小触发
- `file_rotation(max_bytes, max_backups=...)` controls threshold and retained backups / `file_rotation(max_bytes, max_backups=...)` 控制触发阈值和保留备份数
- JSON config uses `sink.rotation.max_bytes` and `sink.rotation.max_backups` / JSON 配置使用 `sink.rotation.max_bytes` 与 `sink.rotation.max_backups`
- `FileSink::reopen()` can explicitly reopen the current file handle / `FileSink::reopen()` 可显式重开当前文件句柄
- `open_failures()`、`write_failures()`、`flush_failures()`、`rotation_failures()` expose basic sink health counters / `open_failures()`、`write_failures()`、`flush_failures()`、`rotation_failures()` 可用于观察基础 sink 健康状态
- current scope is observability-first, not a full self-healing sink runtime / 当前定位仍以可观测性优先,不是完整自愈型 sink runtime