mirror of
https://github.com/Nanaloveyuki/BitLogger.git
synced 2026-07-25 17:32:20 +00:00
📝 Fix policy test and doc
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
name: runtime-sink-file-path
|
||||
group: api
|
||||
category: runtime
|
||||
update-time: 20260613
|
||||
description: Read the effective file path used by a file-backed RuntimeSink.
|
||||
update-time: 20260707
|
||||
description: Read the effective file path used by a file-backed RuntimeSink, with a compatibility fallback for non-file sinks.
|
||||
key-word:
|
||||
- runtime
|
||||
- sink
|
||||
@@ -15,6 +15,8 @@ key-word:
|
||||
|
||||
Read the effective file path used by a file-backed `RuntimeSink`. This helper is useful for diagnostics, support output, and confirming which direct runtime file sink is active.
|
||||
|
||||
`file_path()` is the compatibility form. For truthful file-semantics detection, prefer `file_path_or_none()`.
|
||||
|
||||
### Interface
|
||||
|
||||
```moonbit
|
||||
@@ -36,6 +38,8 @@ Detailed rules explaining key parameters and behaviors
|
||||
- Plain `File` runtime variants return their current file path.
|
||||
- `QueuedFile` runtime variants forward the wrapped inner file sink path.
|
||||
- Non-file runtime variants return an empty string.
|
||||
- This fallback keeps older callers source-compatible, but it does not distinguish “not file-backed” from “file-backed with an empty-looking value”.
|
||||
- New diagnostic code should prefer `file_path_or_none()` when it must avoid fallback values.
|
||||
- This helper is observation-only and does not modify file state.
|
||||
|
||||
### How to Use
|
||||
@@ -65,10 +69,12 @@ In this example, the path can be surfaced without reading broader runtime state.
|
||||
e.g.:
|
||||
- If the runtime sink is not file-backed, the method returns an empty string.
|
||||
|
||||
- If callers need richer file status than just the path, `file_state()` or `file_runtime_state()` is the better API.
|
||||
- If callers need a truthful file-semantics check, use `file_path_or_none()`.
|
||||
|
||||
- If callers need richer file status than just the path, `file_state_or_none()` or `file_runtime_state()` is the better API.
|
||||
|
||||
### Notes
|
||||
|
||||
1. Use this helper for direct runtime path visibility on `RuntimeSink` values.
|
||||
|
||||
2. Empty string usually means the runtime sink is not file-backed.
|
||||
2. Empty string is a compatibility fallback; `file_path_or_none()` is the recommended truthful API.
|
||||
|
||||
Reference in New Issue
Block a user