📝 refresh runtime file constructors docs

This commit is contained in:
Nanaloveyuki
2026-06-13 23:39:24 +08:00
parent 56ba583680
commit 342d08377f
3 changed files with 11 additions and 11 deletions
+2 -2
View File
@@ -13,7 +13,7 @@ key-word:
## File-sink-policy-new
Construct a `FileSinkPolicy` value from explicit append, auto-flush, and rotation settings. This is the low-level constructor behind the public file policy shape used by direct file sinks and configured runtime file controls.
Construct a `FileSinkPolicy` value from explicit append, auto-flush, and rotation settings. This is the low-level constructor behind the public file policy shape used by direct file sinks and higher-level runtime file-control APIs.
### Interface
@@ -42,7 +42,7 @@ Detailed rules explaining key parameters and behaviors
- Omitting optional arguments uses the baseline policy: append enabled, auto-flush enabled, and no rotation.
- This constructor simply packages the supplied settings into one public policy value.
- It does not inspect or mutate a live file sink by itself.
- The resulting value matches the same public shape accepted by `FileSink::set_policy(...)` and `ConfiguredLogger::file_set_policy(...)`.
- The resulting value matches the same public shape accepted by `FileSink::set_policy(...)`, `RuntimeSink::file_set_policy(...)`, and `ConfiguredLogger::file_set_policy(...)`.
### How to Use
+2 -2
View File
@@ -54,7 +54,7 @@ Detailed rules explaining key parameters and behaviors
- Omitting optional arguments uses a conservative baseline snapshot: unavailable, append enabled, auto-flush enabled, no rotation, and zeroed counters.
- This constructor simply packages the supplied fields into one public snapshot value.
- It does not inspect a live `FileSink` by itself.
- `FileSink::state()` and `ConfiguredLogger::file_state()` are the higher-level APIs that read these values from concrete runtime objects.
- `FileSink::state()`, `RuntimeSink::file_state()`, and `ConfiguredLogger::file_state()` are the higher-level APIs that read these values from concrete runtime objects.
### How to Use
@@ -99,7 +99,7 @@ In this example, callers still use the direct constructor while making each diag
e.g.:
- This constructor itself does not have a normal failure mode; it only packages the provided values.
- If callers want a snapshot directly from a live file sink or configured logger, `state()` or `file_state()` is the simpler API.
- If callers want a snapshot directly from a live file sink, runtime sink, or configured logger, `state()` or `file_state()` is the simpler API.
### Notes
+7 -7
View File
@@ -43,8 +43,8 @@ Detailed rules explaining key parameters and behaviors
- Omitting optional arguments builds a non-queued baseline around the supplied file snapshot.
- This constructor simply packages the supplied fields into one public runtime snapshot value.
- It does not inspect a live configured logger by itself.
- `ConfiguredLogger::file_runtime_state()` is the higher-level API that reads these values from concrete runtime objects.
- It does not inspect a live runtime sink or configured logger by itself.
- `RuntimeSink::file_runtime_state()` and `ConfiguredLogger::file_runtime_state()` are the higher-level APIs that read these values from concrete runtime objects.
### How to Use
@@ -62,17 +62,17 @@ let snapshot = RuntimeFileState::new(
)
```
In this example, the runtime file snapshot is built directly without querying a live configured logger.
In this example, the runtime file snapshot is built directly without querying a live runtime object.
#### When Need Structured Runtime Diagnostics Input Before Serialization
When code should prepare a typed runtime file state value for later export:
```moonbit
let snapshot = RuntimeFileState::new(
logger.file_state(),
runtime.file_state(),
queued=true,
pending_count=logger.pending_count(),
dropped_count=logger.dropped_count(),
pending_count=runtime.pending_count(),
dropped_count=runtime.dropped_count(),
)
```
@@ -83,7 +83,7 @@ In this example, callers still use the direct constructor while making each queu
e.g.:
- This constructor itself does not have a normal failure mode; it only packages the provided values.
- If callers want a snapshot directly from a live configured logger, `file_runtime_state()` is the simpler API.
- If callers want a snapshot directly from a live runtime sink or configured logger, `file_runtime_state()` is the simpler API.
### Notes