📝 clarify default logger docs

This commit is contained in:
Nanaloveyuki
2026-06-14 01:35:25 +08:00
parent d4db20fffc
commit bf545b0e0c
2 changed files with 6 additions and 0 deletions
+2
View File
@@ -31,8 +31,10 @@ Detailed rules explaining key parameters and behaviors
- This API wraps `default_logger()` as a library facade. - This API wraps `default_logger()` as a library facade.
- Each call reflects the current shared default minimum level and default target at that moment. - Each call reflects the current shared default minimum level and default target at that moment.
- The returned facade wraps the same underlying `Logger[ConsoleSink]` value that `default_logger()` would produce directly at that moment.
- The returned value exposes the narrower `LibraryLogger` surface rather than the full `Logger` surface. - The returned value exposes the narrower `LibraryLogger` surface rather than the full `Logger` surface.
- Later changes to shared defaults do not mutate an already-created facade value because the wrapped logger is captured when `default_library_logger()` is called. - Later changes to shared defaults do not mutate an already-created facade value because the wrapped logger is captured when `default_library_logger()` is called.
- Call `default_library_logger()` again after shared default changes if a fresh narrowed value should reflect the updated defaults.
### How to Use ### How to Use
+4
View File
@@ -31,7 +31,9 @@ Detailed rules explaining key parameters and behaviors
- The returned logger is built from `default_console_sink`, `default_min_level_ref`, and `default_target_ref`. - The returned logger is built from `default_console_sink`, `default_min_level_ref`, and `default_target_ref`.
- Each call reflects the current shared configuration at that moment. - Each call reflects the current shared configuration at that moment.
- `default_logger()` constructs a fresh `Logger::new(...)` value on each call while reusing the shared default console sink and the current stored default level and target values.
- The logger writes to the standard console sink path. - The logger writes to the standard console sink path.
- The global helper functions such as `log(...)`, `info(...)`, and `error(...)` call `default_logger()` for each write instead of holding one long-lived default logger instance.
- This helper is useful when you want the same baseline behavior as the global shortcuts but still need the explicit `Logger` object for chaining or inspection. - This helper is useful when you want the same baseline behavior as the global shortcuts but still need the explicit `Logger` object for chaining or inspection.
### How to Use ### How to Use
@@ -73,3 +75,5 @@ e.g.:
2. It is the bridge between the simple global API and the explicit typed logger workflow. 2. It is the bridge between the simple global API and the explicit typed logger workflow.
3. Call `default_logger()` again after `set_default_min_level(...)` or `set_default_target(...)` if a fresh explicit logger value should reflect the updated shared defaults.