pub struct DebugLogger { /* private fields */ }Expand description
Debug logger that collects messages during execution.
Passed as &mut Option<DebugLogger> to functions:
None= logging disabled (production mode)Some(logger)= logging enabled (debug mode)
Implementations§
Source§impl DebugLogger
impl DebugLogger
Sourcepub fn with_min_level(min_level: DebugLevel) -> Self
pub fn with_min_level(min_level: DebugLevel) -> Self
Create a logger with minimum level filter
Sourcepub fn with_categories(categories: Vec<DebugCategory>) -> Self
pub fn with_categories(categories: Vec<DebugCategory>) -> Self
Create a logger that only records specific categories
Sourcepub fn set_window_context(&mut self, window_id: Option<String>)
pub fn set_window_context(&mut self, window_id: Option<String>)
Set the current window context for subsequent messages
Sourcepub fn log(
&mut self,
level: DebugLevel,
category: DebugCategory,
message: impl Into<String>,
)
pub fn log( &mut self, level: DebugLevel, category: DebugCategory, message: impl Into<String>, )
Log a message with full control over all fields
Sourcepub fn trace(&mut self, category: DebugCategory, message: impl Into<String>)
pub fn trace(&mut self, category: DebugCategory, message: impl Into<String>)
Log a trace message
Sourcepub fn debug(&mut self, category: DebugCategory, message: impl Into<String>)
pub fn debug(&mut self, category: DebugCategory, message: impl Into<String>)
Log a debug message
Sourcepub fn info(&mut self, category: DebugCategory, message: impl Into<String>)
pub fn info(&mut self, category: DebugCategory, message: impl Into<String>)
Log an info message
Sourcepub fn warn(&mut self, category: DebugCategory, message: impl Into<String>)
pub fn warn(&mut self, category: DebugCategory, message: impl Into<String>)
Log a warning
Sourcepub fn error(&mut self, category: DebugCategory, message: impl Into<String>)
pub fn error(&mut self, category: DebugCategory, message: impl Into<String>)
Log an error
Sourcepub fn take_messages(&mut self) -> Vec<LogMessage>
pub fn take_messages(&mut self) -> Vec<LogMessage>
Take all collected messages (empties the logger)
Sourcepub fn messages(&self) -> &[LogMessage]
pub fn messages(&self) -> &[LogMessage]
Get a reference to collected messages
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DebugLogger
impl RefUnwindSafe for DebugLogger
impl Send for DebugLogger
impl Sync for DebugLogger
impl Unpin for DebugLogger
impl UnwindSafe for DebugLogger
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more