mirror of
https://github.com/Nanaloveyuki/BitLogger.git
synced 2026-07-24 00:42:18 +00:00
📝 align async runtime serialization docs
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
name: async-runtime-mode-label
|
||||
group: api
|
||||
category: async
|
||||
update-time: 20260512
|
||||
description: Convert AsyncRuntimeMode into a stable string label for logs, JSON, and diagnostics.
|
||||
update-time: 20260614
|
||||
description: Convert AsyncRuntimeMode into its canonical stable string label for logs, JSON, and diagnostics.
|
||||
key-word:
|
||||
- async
|
||||
- runtime
|
||||
@@ -37,6 +37,7 @@ Detailed rules explaining key parameters and behaviors
|
||||
- It keeps mode serialization logic in one place.
|
||||
- This helper is used by async runtime JSON helpers.
|
||||
- Labels are more stable for telemetry and docs than ad hoc manual matching at call sites.
|
||||
- The current canonical labels are exactly `native_worker` for `NativeWorker` and `compatibility` for `Compatibility`.
|
||||
|
||||
### How to Use
|
||||
|
||||
@@ -67,3 +68,9 @@ e.g.:
|
||||
|
||||
- If callers need the whole runtime object rather than a string label, use `async_runtime_state()`.
|
||||
|
||||
### Notes
|
||||
|
||||
1. Use this helper when mode values should be rendered as stable text instead of manual enum matching.
|
||||
|
||||
2. `async_runtime_state_to_json(...)` uses these exact labels when serializing runtime snapshots.
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
name: async-runtime-state-to-json
|
||||
group: api
|
||||
category: async
|
||||
update-time: 20260512
|
||||
description: Convert AsyncRuntimeState into a JSON value for runtime capability and mode diagnostics.
|
||||
update-time: 20260614
|
||||
description: Convert AsyncRuntimeState into a JSON value for runtime capability and mode diagnostics using the canonical mode labels and snapshot field names.
|
||||
key-word:
|
||||
- async
|
||||
- state
|
||||
@@ -35,6 +35,7 @@ Detailed rules explaining key parameters and behaviors
|
||||
|
||||
- The output includes `mode` and `background_worker`.
|
||||
- `mode` is serialized through `async_runtime_mode_label(...)`.
|
||||
- The compact serialized shape is `{"mode":"native_worker|compatibility","background_worker":true|false}`.
|
||||
- This helper focuses on runtime capabilities rather than queue counters or logger lifecycle flags.
|
||||
- The exported JSON is suitable for diagnostics endpoints and startup environment checks.
|
||||
|
||||
@@ -67,3 +68,9 @@ e.g.:
|
||||
|
||||
- If the runtime is in compatibility mode, the helper still serializes normally using the matching mode label.
|
||||
|
||||
### Notes
|
||||
|
||||
1. The output field names are fixed as `mode` and `background_worker`.
|
||||
|
||||
2. The `mode` field always uses the canonical labels from `async_runtime_mode_label(...)`, not enum names like `NativeWorker` or `Compatibility`.
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
name: stringify-async-runtime-state
|
||||
group: api
|
||||
category: async
|
||||
update-time: 20260512
|
||||
description: Serialize AsyncRuntimeState into compact or pretty JSON text for diagnostics and startup reporting.
|
||||
update-time: 20260614
|
||||
description: Serialize AsyncRuntimeState into compact or pretty JSON text for diagnostics and startup reporting using the canonical runtime snapshot shape.
|
||||
key-word:
|
||||
- async
|
||||
- state
|
||||
@@ -40,6 +40,7 @@ Detailed rules explaining key parameters and behaviors
|
||||
- `pretty=false` returns compact JSON.
|
||||
- `pretty=true` returns indented JSON for human diagnostics.
|
||||
- This helper is built on top of `async_runtime_state_to_json(...)`.
|
||||
- The compact form matches the tested snapshot shape such as `{"mode":"native_worker","background_worker":true}`.
|
||||
- It is well-suited for startup banners, support reports, and target capability logs.
|
||||
|
||||
### How to Use
|
||||
@@ -71,3 +72,9 @@ e.g.:
|
||||
|
||||
- If more complete async logger diagnostics are required, this helper should be replaced with `stringify_async_logger_state(...)`.
|
||||
|
||||
### Notes
|
||||
|
||||
1. The compact output uses the same canonical `mode` labels as `async_runtime_mode_label(...)`.
|
||||
|
||||
2. This helper is the direct text form of the same two-field runtime snapshot exported by `async_runtime_state_to_json(...)`.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user