📝 consolidate logger API and async lifecycle guidance

This commit is contained in:
Nanaloveyuki
2026-06-14 14:00:00 +08:00
parent 4f2ad097af
commit 265cd69ea9
154 changed files with 2419 additions and 396 deletions
+7 -1
View File
@@ -3,7 +3,7 @@ name: library-logger-child
group: api
category: facade
update-time: 20260613
description: Derive a child LibraryLogger facade by composing the current target with a child segment.
description: Derive a child LibraryLogger facade by composing the current target with a child segment while rewrapping the same underlying logger state.
key-word:
- library
- facade
@@ -38,6 +38,8 @@ Detailed rules explaining key parameters and behaviors
- 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, minimum level, timestamp behavior, and any existing sink wrappers remain the same because only the derived target changes.
- Broader composition helpers remain hidden behind the narrower facade after rewrapping; use `to_logger()` if later code needs them.
### How to Use
@@ -65,6 +67,8 @@ let client = LibraryLogger::new(console_sink(), target="sdk")
In this example, the final facade emits under `sdk.http.client`.
And the target derivation does not rebuild or reset the wrapped logger pipeline.
### Error Case
e.g.:
@@ -77,3 +81,5 @@ e.g.:
1. This is the preferred library-facing API for hierarchical target naming.
2. Composition uses `.` as the separator between parent and child segments.
3. Use `with_target(...)` instead when the new target should replace the current target rather than extend it.