📝 clarify logger target replacement

This commit is contained in:
Nanaloveyuki
2026-06-14 11:27:11 +08:00
parent 5720ba6203
commit 480c5ad602
+5
View File
@@ -38,6 +38,7 @@ Detailed rules explaining key parameters and behaviors
- This API replaces the default target instead of composing it.
- Per-call `target?` arguments can still override the default target on individual log calls.
- The original logger value is not mutated.
- In the current direct sync coverage, a derived retargeted logger keeps existing flags such as `timestamp`, while the original logger still retains its previous target.
### How to Use
@@ -66,6 +67,8 @@ let api = base.with_target("api")
In this example, target routing stays explicit without duplicating sink construction.
And the derived loggers keep the same underlying logger behavior apart from the replaced stored target.
### Error Case
e.g.:
@@ -79,3 +82,5 @@ e.g.:
2. It is useful when one sink serves several target namespaces.
3. Use it when you want a derived logger value; the original logger keeps its earlier default target.