mirror of
https://github.com/Nanaloveyuki/BitLogger.git
synced 2026-07-24 00:42:18 +00:00
📝 clarify default logger snapshot semantics
This commit is contained in:
@@ -32,6 +32,7 @@ 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.
|
- `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.
|
||||||
|
- Later calls to `set_default_min_level(...)` or `set_default_target(...)` do not mutate a logger value that was already returned earlier.
|
||||||
- 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.
|
- 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.
|
||||||
@@ -50,6 +51,8 @@ logger.info("service started")
|
|||||||
|
|
||||||
In this example, the logger starts from global defaults and then gains extra instance-level behavior.
|
In this example, the logger starts from global defaults and then gains extra instance-level behavior.
|
||||||
|
|
||||||
|
Later shared-default changes still require calling `default_logger()` again if a fresh explicit logger value should observe them.
|
||||||
|
|
||||||
#### When Inspect Current Shared Behavior
|
#### When Inspect Current Shared Behavior
|
||||||
|
|
||||||
When code should branch using the same threshold as global helpers:
|
When code should branch using the same threshold as global helpers:
|
||||||
|
|||||||
Reference in New Issue
Block a user