2.1 KiB
name, group, category, update-time, description, key-word
| name | group | category | update-time | description | key-word | ||||
|---|---|---|---|---|---|---|---|---|---|
| stringify-runtime-file-state | api | runtime | 20260512 | Serialize RuntimeFileState into compact or pretty JSON text for queued-file diagnostics and support output. |
|
Stringify-runtime-file-state
Serialize RuntimeFileState into JSON text. This helper is the most direct export path for combined file-and-queue runtime diagnostics.
Interface
pub fn stringify_runtime_file_state(state : RuntimeFileState, pretty~ : Bool = false) -> String {}
input
state : RuntimeFileState- Combined file and queue runtime snapshot to serialize.pretty : Bool- Whether JSON should be pretty-printed.
output
String- Serialized JSON text for the runtime file state.
Explanation
Detailed rules explaining key parameters and behaviors
pretty=falsereturns compact JSON.pretty=truereturns indented JSON for human diagnostics.- This helper builds on top of
runtime_file_state_to_json(...). - The output is useful when queued file runtime state should be printed directly during support or incident handling.
How to Use
Here are some specific examples provided.
When Need Human-readable Queued-file Diagnostics
When a queued file runtime snapshot should be printed directly:
println(stringify_runtime_file_state(snapshot, pretty=true))
In this example, both file state and queue metrics are shown in one readable JSON payload.
When Need Compact Runtime Snapshot Export
When a combined file-and-queue snapshot should stay small:
let text = stringify_runtime_file_state(snapshot)
In this example, compact JSON is returned without extra formatting logic.
Error Case
e.g.:
-
If callers need a
JsonValuerather than text,runtime_file_state_to_json(...)is the better API. -
If queue wrapping is not relevant,
stringify_file_sink_state(...)may be the simpler API.
Notes
-
Use this helper when queued-file diagnostics should be emitted as one JSON string.
-
pretty=trueis useful for support output and manual inspection.