mirror of
https://github.com/Nanaloveyuki/BitLogger.git
synced 2026-07-30 06:26:38 +00:00
📝 Fix policy test and doc
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
name: configured-logger-file-available
|
||||
group: api
|
||||
category: runtime
|
||||
update-time: 20260512
|
||||
update-time: 20260707
|
||||
description: Read whether the configured runtime logger currently has an available file sink behind its runtime sink shape.
|
||||
key-word:
|
||||
- logger
|
||||
@@ -36,6 +36,8 @@ Detailed rules explaining key parameters and behaviors
|
||||
- File-backed runtime sinks report actual file availability through the wrapped `RuntimeSink`.
|
||||
- Queued file sinks still expose the availability of their wrapped inner file sink.
|
||||
- Non-file sinks report `false`.
|
||||
- This means `false` currently merges two different situations: “not file-backed” and “file-backed but currently unavailable”.
|
||||
- Use `file_path_or_none()`, `file_policy_or_none()`, `file_default_policy_or_none()`, `file_state_or_none()`, or `file_runtime_state()` when callers need truthful file-semantics detection.
|
||||
- This helper delegates to the runtime sink and does not mutate logger state.
|
||||
|
||||
### How to Use
|
||||
@@ -67,10 +69,12 @@ In this example, callers can decide whether a recovery action is needed.
|
||||
e.g.:
|
||||
- If the configured sink is not file-backed, the method returns `false`.
|
||||
|
||||
- If callers need detailed failure counters rather than a simple availability flag, `file_state()` or `file_runtime_state()` is the better API.
|
||||
- If callers need to distinguish “not file-backed” from “file-backed but unavailable”, use one of the truthful `*_or_none()` helpers or `file_runtime_state()`.
|
||||
|
||||
- If callers need detailed failure counters rather than a simple availability flag, `file_state_or_none()` or `file_runtime_state()` is the better API.
|
||||
|
||||
### Notes
|
||||
|
||||
1. Use this helper for lightweight file sink health checks.
|
||||
|
||||
2. Pair it with reopen and failure-counter APIs when diagnosing file sink problems.
|
||||
2. Pair it with reopen and failure-counter APIs when diagnosing file sink problems, but prefer the truthful `*_or_none()` helpers when file semantics themselves must be checked.
|
||||
|
||||
Reference in New Issue
Block a user