📝 clarify async state snapshot docs

This commit is contained in:
Nanaloveyuki
2026-06-14 07:04:55 +08:00
parent 6c5f4aaa0e
commit a2b37dfe53
3 changed files with 13 additions and 4 deletions
+3
View File
@@ -56,6 +56,7 @@ Detailed rules explaining key parameters and behaviors
- The constructed value matches the same public shape used by async logger serializers.
- Because `AsyncLoggerState` is only a data snapshot type, this constructor is mainly useful for tests, adapters, and synthetic diagnostics rather than ordinary logger inspection.
- Serialization helpers accept any `AsyncLoggerState` value, including hand-built ones from this constructor.
- That includes combinations such as `has_failed=true` together with non-zero `pending_count` or a retained `last_error`, which are valid for diagnostic snapshots and test fixtures.
### How to Use
@@ -106,6 +107,8 @@ e.g.:
- If callers manually combine a runtime snapshot, counters, or flush policy that do not actually belong together, the constructor still accepts that synthetic snapshot.
- This constructor does not apply cleanup semantics such as clearing `last_error` on restart or draining pending records; callers must provide those fields exactly as they want them represented.
### Notes
1. Use this helper when code should construct an `AsyncLoggerState` value explicitly.