📝 clarify default level snapshot semantics

This commit is contained in:
Nanaloveyuki
2026-06-14 12:03:45 +08:00
parent bf27dacf23
commit cf23bb6dbe
+6 -1
View File
@@ -36,6 +36,7 @@ Detailed rules explaining key parameters and behaviors
- The function updates the internal `Ref[Level]` used by `default_logger()`. - The function updates the internal `Ref[Level]` used by `default_logger()`.
- It does not mutate any separately stored `Logger` values that were created earlier. - It does not mutate any separately stored `Logger` values that were created earlier.
- Later calls to `default_logger()` and the global logging shortcuts observe the new threshold. - Later calls to `default_logger()` and the global logging shortcuts observe the new threshold.
- Any explicit logger value that was already created earlier keeps the threshold it captured at creation time.
- This is the main API for adjusting process-wide default severity without building a custom logger variable. - This is the main API for adjusting process-wide default severity without building a custom logger variable.
### How to Use ### How to Use
@@ -61,6 +62,8 @@ debug("cache probe enabled")
In this example, the shared global path starts accepting debug records. In this example, the shared global path starts accepting debug records.
Earlier explicit logger values still keep whatever default threshold they captured before this change.
### Error Case ### Error Case
e.g.: e.g.:
@@ -72,5 +75,7 @@ e.g.:
1. This API only affects the shared default logger workflow. 1. This API only affects the shared default logger workflow.
2. Prefer explicit logger instances when different subsystems need different thresholds at the same time. 2. Call `default_logger()` again after changing the default if a fresh explicit logger value should reflect the new threshold.
3. Prefer explicit logger instances when different subsystems need different thresholds at the same time.