mirror of
https://github.com/Nanaloveyuki/BitLogger.git
synced 2026-05-30 15:42:25 +00:00
1.7 KiB
1.7 KiB
name, group, category, update-time, description, key-word
| name | group | category | update-time | description | key-word | ||||
|---|---|---|---|---|---|---|---|---|---|
| default-library-logger | api | facade | 20260520 | Create the default library-facing console logger facade from shared global defaults. |
|
Default-library-logger
Create a LibraryLogger[ConsoleSink] from the current shared default console logger settings. This is the narrow library-facing counterpart to default_logger().
Interface
pub fn default_library_logger() -> LibraryLogger[ConsoleSink] {
output
LibraryLogger[ConsoleSink]- Library-facing console logger built from the current shared defaults.
Explanation
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 value exposes the narrower
LibraryLoggersurface rather than the fullLoggersurface.
How to Use
Here are some specific examples provided.
When Need A Default Logger But Want A Narrower Facade
When a library should adopt the shared console defaults without exposing the full logger type:
let logger = default_library_logger()
if logger.is_enabled(Level::Info) {
logger.info("ready")
}
In this example, the library facade mirrors the current global defaults.
Error Case
e.g.:
-
If the shared default target is empty, the returned logger is still valid.
-
Later changes to shared defaults do not mutate an already-created facade value.
Notes
-
Use
to_logger()if callers need the full sync logger surface. -
This helper is useful for library-facing APIs that should stay narrower than
Logger.