From bf545b0e0c4ae93a63e301217ad418d3a884c612 Mon Sep 17 00:00:00 2001 From: Nanaloveyuki Date: Sun, 14 Jun 2026 01:35:25 +0800 Subject: [PATCH] :memo: clarify default logger docs --- docs/api/default-library-logger.md | 2 ++ docs/api/default-logger.md | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/docs/api/default-library-logger.md b/docs/api/default-library-logger.md index 5e30f1a..d5fa529 100644 --- a/docs/api/default-library-logger.md +++ b/docs/api/default-library-logger.md @@ -31,8 +31,10 @@ Detailed rules explaining key parameters and behaviors - This API wraps `default_logger()` as a library facade. - 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. - 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 diff --git a/docs/api/default-logger.md b/docs/api/default-logger.md index 4e27b33..9e3eea7 100644 --- a/docs/api/default-logger.md +++ b/docs/api/default-logger.md @@ -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`. - 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 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. ### 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. +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. +