From 22f52042629180f1a9076b079ee45f456c3f5268 Mon Sep 17 00:00:00 2001 From: Nanaloveyuki Date: Sun, 14 Jun 2026 10:53:59 +0800 Subject: [PATCH] :memo: clarify library async child facade preservation --- docs/api/library-async-logger-child.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/docs/api/library-async-logger-child.md b/docs/api/library-async-logger-child.md index fb9b543..8ca305d 100644 --- a/docs/api/library-async-logger-child.md +++ b/docs/api/library-async-logger-child.md @@ -2,8 +2,8 @@ name: library-async-logger-child group: api category: facade -update-time: 20260613 -description: Derive a child LibraryAsyncLogger facade by composing the current target with a child segment while rewrapping the same underlying async logger state. +update-time: 20260614 +description: Derive a child LibraryAsyncLogger facade by composing the current target with a child segment while rewrapping the derived async logger state behind the same library-facing surface. key-word: - async - library @@ -37,11 +37,12 @@ pub fn[S] LibraryAsyncLogger::child( Detailed rules explaining key parameters and behaviors -- This API delegates to the wrapped async logger's `child(...)` behavior and then re-wraps the result. +- This API delegates to the wrapped async logger's `child(...)` behavior and then re-wraps the result as another `LibraryAsyncLogger[S]`. - If the parent target is empty, the child target becomes the full target. - If the child target is empty, the parent target is preserved. - If both are non-empty, they are joined with `.`. -- Sink type, queue state, async config, and failure/lifecycle state remain the same because only the derived default target changes. +- The original facade is not mutated. The returned facade stores the derived child target while the source facade keeps its previous parent target. +- Timestamp behavior, enabled-level gating, sink type, queue state, async config, and failure/lifecycle state remain the same because only the derived default target changes. - Async state helpers remain hidden behind the narrower facade after rewrapping; use `to_async_logger()` if later code needs them. ### How to Use @@ -72,6 +73,8 @@ In this example, the final facade emits under `sdk.http.client`. And the target derivation does not rebuild or reset the wrapped async logger state. +The derived facade still uses the same timestamp and level-gating behavior as the source facade. + ### Error Case e.g.: