pub struct CallbackManager { /* private fields */ }Expand description
Manages all callback types for the logging system.
CallbackManager is thread-safe and allows multiple callbacks of each type to be registered and executed. All callbacks are stored in Arc<RwLock<>> for safe concurrent access.
Implementations§
Source§impl CallbackManager
impl CallbackManager
Sourcepub fn add_log_callback(&self, callback: LogCallback)
pub fn add_log_callback(&self, callback: LogCallback)
Adds a log callback that will be executed for each log record.
§Arguments
callback- Function that takes a LogRecord and returns Result<(), String>
Sourcepub fn add_color_callback(&self, callback: ColorCallback)
pub fn add_color_callback(&self, callback: ColorCallback)
Adds a color callback for custom color formatting.
§Arguments
callback- Function that takes Level and message, returns formatted string
Sourcepub fn add_exception_callback(&self, callback: ExceptionCallback)
pub fn add_exception_callback(&self, callback: ExceptionCallback)
Adds an exception callback for error handling.
§Arguments
callback- Function that takes error message and backtrace
Sourcepub fn execute_log_callbacks(&self, record: &LogRecord) -> Vec<String>
pub fn execute_log_callbacks(&self, record: &LogRecord) -> Vec<String>
Sourcepub fn execute_exception_callbacks(&self, error: &str, backtrace: &str)
pub fn execute_exception_callbacks(&self, error: &str, backtrace: &str)
Executes all registered exception callbacks.
§Arguments
error- Error messagebacktrace- Stack backtrace string
Sourcepub fn clear_log_callbacks(&self)
pub fn clear_log_callbacks(&self)
Clears all registered log callbacks.
Sourcepub fn clear_color_callbacks(&self)
pub fn clear_color_callbacks(&self)
Clears all registered color callbacks.
Sourcepub fn clear_exception_callbacks(&self)
pub fn clear_exception_callbacks(&self)
Clears all registered exception callbacks.
Trait Implementations§
Source§impl Clone for CallbackManager
impl Clone for CallbackManager
Source§fn clone(&self) -> CallbackManager
fn clone(&self) -> CallbackManager
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for CallbackManager
impl !RefUnwindSafe for CallbackManager
impl Send for CallbackManager
impl Sync for CallbackManager
impl Unpin for CallbackManager
impl !UnwindSafe for CallbackManager
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