pub struct LoggerConfigBuilder { /* private fields */ }
Expand description
Builder for creating logger configurations.
Implementations§
Source§impl LoggerConfigBuilder
impl LoggerConfigBuilder
Sourcepub fn add_handler(self, handler: HandlerRef) -> Self
pub fn add_handler(self, handler: HandlerRef) -> Self
Add a handler to the configuration.
Sourcepub fn capture_source(self, capture: bool) -> Self
pub fn capture_source(self, capture: bool) -> Self
Set whether to capture source location information.
Sourcepub fn use_colors(self, use_colors: bool) -> Self
pub fn use_colors(self, use_colors: bool) -> Self
Set whether to use colors in console output.
Sourcepub fn with_env_overrides(self) -> Self
pub fn with_env_overrides(self) -> Self
Apply environment variable overrides to the configuration.
Supported environment variables:
- LOGURU_LEVEL (e.g., “Debug”, “Info”, “Warn”, “Error”)
- LOGURU_CAPTURE_SOURCE (“true”/“false”)
- LOGURU_USE_COLORS (“true”/“false”)
- LOGURU_FORMAT (format string)
Sourcepub fn build(self) -> LoggerConfig
pub fn build(self) -> LoggerConfig
Build the final configuration.
Sourcepub fn from_toml_str(self, toml_str: &str) -> Result<Self, Error>
pub fn from_toml_str(self, toml_str: &str) -> Result<Self, Error>
Load configuration from a TOML string. Builder/env overrides take precedence.
Supported TOML keys:
- level (e.g., “Debug”, “Info”, “Warn”, “Error”)
- capture_source (bool)
- use_colors (bool)
- format (string)
Trait Implementations§
Source§impl Debug for LoggerConfigBuilder
impl Debug for LoggerConfigBuilder
Auto Trait Implementations§
impl Freeze for LoggerConfigBuilder
impl !RefUnwindSafe for LoggerConfigBuilder
impl Send for LoggerConfigBuilder
impl Sync for LoggerConfigBuilder
impl Unpin for LoggerConfigBuilder
impl !UnwindSafe for LoggerConfigBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more