mirror of
https://github.com/Nanaloveyuki/BitLogger.git
synced 2026-08-02 08:24:42 +00:00
📝 clarify library async target replacement
This commit is contained in:
@@ -2,8 +2,8 @@
|
|||||||
name: library-async-logger-with-target
|
name: library-async-logger-with-target
|
||||||
group: api
|
group: api
|
||||||
category: facade
|
category: facade
|
||||||
update-time: 20260613
|
update-time: 20260614
|
||||||
description: Replace the default target carried by a LibraryAsyncLogger facade while rewrapping the same underlying async logger state.
|
description: Replace the default target carried by a LibraryAsyncLogger facade while rewrapping the derived async logger state behind the same library-facing surface.
|
||||||
key-word:
|
key-word:
|
||||||
- async
|
- async
|
||||||
- library
|
- library
|
||||||
@@ -37,11 +37,11 @@ pub fn[S] LibraryAsyncLogger::with_target(
|
|||||||
|
|
||||||
Detailed rules explaining key parameters and behaviors
|
Detailed rules explaining key parameters and behaviors
|
||||||
|
|
||||||
- This API delegates to the wrapped async logger's `with_target(...)` behavior and then re-wraps the result.
|
- This API delegates to the wrapped async logger's `with_target(...)` behavior and then re-wraps the result as another `LibraryAsyncLogger[S]`.
|
||||||
- The returned value keeps the same sink type, queue state, async config, and failure/lifecycle state because only the default target field changes.
|
- The original facade is not mutated. The returned facade stores the replacement target while the source facade keeps its previous target.
|
||||||
|
- Timestamp behavior, enabled-level gating, sink type, queue state, async config, and failure/lifecycle state stay the same because only the default target field changes.
|
||||||
- This replaces the default target instead of composing it.
|
- This replaces the default target instead of composing it.
|
||||||
- Async state helpers remain hidden behind the narrower facade after rewrapping; use `to_async_logger()` if later code needs them.
|
- Async state helpers remain hidden behind the narrower facade after rewrapping; use `to_async_logger()` if later code needs them.
|
||||||
- The original facade value is not mutated.
|
|
||||||
|
|
||||||
### How to Use
|
### How to Use
|
||||||
|
|
||||||
@@ -73,6 +73,8 @@ In this example, one base facade becomes several target-specific async facades.
|
|||||||
|
|
||||||
And each derived facade still wraps the same kind of queue-backed async logger state, differing only in the default target it carries.
|
And each derived facade still wraps the same kind of queue-backed async logger state, differing only in the default target it carries.
|
||||||
|
|
||||||
|
The derived facade keeps the same timestamp and level-gating behavior as the source facade.
|
||||||
|
|
||||||
### Error Case
|
### Error Case
|
||||||
|
|
||||||
e.g.:
|
e.g.:
|
||||||
|
|||||||
Reference in New Issue
Block a user