Add file rotation introspection helpers

This commit is contained in:
Nanaloveyuki
2026-05-10 12:42:36 +08:00
parent b68ba073b4
commit 14eaf9e178
8 changed files with 72 additions and 3 deletions
+2 -1
View File
@@ -224,7 +224,8 @@ if native_files_supported() {
- `file_sink(...)` 还提供 `reopen()``open_failures()``write_failures()``flush_failures()``rotation_failures()`,用于基础可观测性
- `file_sink(...)` 当前还提供 `append_mode()``reopen(append=...)` 在显式传值时会更新后续 reopen 使用的 append 策略
- `file_sink(...)` 也可直接读取 `path()``auto_flush_enabled()` 等基础 file 策略状态
- `build_logger(...)` 产出的 `ConfiguredLogger` 同样提供 `file_reopen()``file_flush()``file_close()``file_append_mode()``file_path()``file_auto_flush()` 与对应 file failure 计数访问器,便于配置式接入后继续运维控制
- `file_sink(...)` 还提供 `rotation_enabled()``rotation_config()`,可直接查询当前 rotation 策略是否启用及其参数
- `build_logger(...)` 产出的 `ConfiguredLogger` 同样提供 `file_reopen()``file_flush()``file_close()``file_append_mode()``file_path()``file_auto_flush()``file_rotation_enabled()``file_rotation_config()` 与对应 file failure 计数访问器,便于配置式接入后继续运维控制
- `sink.text_formatter.template` 当前支持固定 token`{timestamp}``{timestamp_ms}``{level}``{target}``{message}``{fields}`
- 当前可由配置直接组装的 sink 类型:`console``json_console``text_console``file`
- `queue` 会作为显式包装层附着在最终 sink 外侧;这仍然是同步 drain 模型,不是 async runtime