mirror of
https://github.com/Nanaloveyuki/BitLogger.git
synced 2026-07-29 22:16:34 +00:00
📝 refine library logger wrapper methods
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user