mirror of
https://github.com/Nanaloveyuki/BitLogger.git
synced 2026-07-30 06:26:38 +00:00
📝 refine library async wrapper methods
This commit is contained in:
@@ -3,7 +3,7 @@ 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.
|
||||
description: Derive a child LibraryAsyncLogger facade by composing the current target with a child segment while rewrapping the same underlying async logger state.
|
||||
key-word:
|
||||
- async
|
||||
- library
|
||||
@@ -41,6 +41,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, 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
|
||||
|
||||
@@ -68,6 +70,8 @@ let client = LibraryAsyncLogger::new(@bitlogger.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 async logger state.
|
||||
|
||||
### Error Case
|
||||
|
||||
e.g.:
|
||||
@@ -80,3 +84,5 @@ e.g.:
|
||||
1. This is the preferred library-facing API for hierarchical async target naming.
|
||||
|
||||
2. Composition changes the target only and does not rebuild the queue or sink.
|
||||
|
||||
3. Use `with_target(...)` instead when the new target should replace the current target rather than extend it.
|
||||
|
||||
Reference in New Issue
Block a user