pub struct Log {
pub channel: String,
pub level: LogLevel,
pub message: String,
}Expand description
Represents a log entry.
Log beautifully implements Display for easy printing.
use breadcrumbs::Log;
let log = Log::new(String::from("test_channel"), breadcrumbs::LogLevel::Info, String::from("Test log message"));
assert_eq!(format!("{}", log), "[test_channel/Info] Test log message");Fields§
§channel: String§level: LogLevel§message: StringImplementations§
Source§impl Log
impl Log
Sourcepub fn remove(&self)
pub fn remove(&self)
Removes the log from the stored traceback of logs. This log will not use up memory or be printed by the traceback macros. Useful in embedded systems where memory is limited.
§Example Usecase
use breadcrumbs::{LogListener, Log};
struct MyLogListener;
impl LogListener for MyLogListener {
fn on_log(&mut self, log: Log) {
if !log.level.is_at_least(breadcrumbs::LogLevel::Warn) {
log.remove();
}
}
}Trait Implementations§
Source§impl Ord for Log
impl Ord for Log
Source§impl PartialOrd for Log
impl PartialOrd for Log
impl Eq for Log
impl StructuralPartialEq for Log
Auto Trait Implementations§
impl Freeze for Log
impl RefUnwindSafe for Log
impl Send for Log
impl Sync for Log
impl Unpin for Log
impl UnwindSafe for Log
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