pub struct DebugLog;Expand description
The global debug log.
Implementations§
Source§impl DebugLog
impl DebugLog
Sourcepub fn enabled() -> bool
pub fn enabled() -> bool
Whether debug logging is on. Defaults to on in debug builds and off in release builds.
Sourcepub fn set_enabled(enabled: bool)
pub fn set_enabled(enabled: bool)
Turns debug logging on or off.
Sourcepub fn add_listener(listener: Arc<dyn IDebugListener>)
pub fn add_listener(listener: Arc<dyn IDebugListener>)
Adds a listener.
Sourcepub fn add_listener_function(
action: impl Fn(&str, &str) + Send + Sync + 'static,
) -> u64
pub fn add_listener_function( action: impl Fn(&str, &str) + Send + Sync + 'static, ) -> u64
Adds a listener function. Closures can’t be compared, so use the
returned handle with DebugLog::remove_listener_function to remove it.
Sourcepub fn remove_listener(listener: &Arc<dyn IDebugListener>)
pub fn remove_listener(listener: &Arc<dyn IDebugListener>)
Removes a listener (compared by identity).
Sourcepub fn remove_listener_function(id: u64)
pub fn remove_listener_function(id: u64)
Removes a listener function added with
DebugLog::add_listener_function.
Sourcepub fn clear_listeners()
pub fn clear_listeners()
Removes all listeners.
Sourcepub fn subscribe() -> Receiver<DebugLogMessage>
pub fn subscribe() -> Receiver<DebugLogMessage>
Subscribes to debug log messages. A receiver that falls behind gets
RecvError::Lagged and misses messages.
Sourcepub fn write_line(category: &str, msg: &str)
pub fn write_line(category: &str, msg: &str)
Writes a line to the debug log.
Sourcepub fn write_line_args(category: &str, msg: &str, args: &[&str])
pub fn write_line_args(category: &str, msg: &str, args: &[&str])
Writes a line to the debug log, filling {0}, {1}, … in msg from
args ({{ and }} are literal braces). Format specifiers like
{0:X} aren’t supported and are left as they are.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DebugLog
impl RefUnwindSafe for DebugLog
impl Send for DebugLog
impl Sync for DebugLog
impl Unpin for DebugLog
impl UnsafeUnpin for DebugLog
impl UnwindSafe for DebugLog
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