pub struct RingTracer { /* private fields */ }Expand description
A ring buffer for trace events that overwrites the oldest entries.
Implementations§
Source§impl RingTracer
impl RingTracer
Sourcepub fn new(capacity: usize, level: TraceLevel) -> Self
pub fn new(capacity: usize, level: TraceLevel) -> Self
Create a ring tracer with the given capacity and level.
Sourcepub fn log(&mut self, event: TraceEvent)
pub fn log(&mut self, event: TraceEvent)
Log a trace event (overwrites oldest if full).
Sourcepub fn log_msg(&mut self, level: TraceLevel, msg: impl Into<String>)
pub fn log_msg(&mut self, level: TraceLevel, msg: impl Into<String>)
Log a message at the given level.
Sourcepub fn stored_count(&self) -> usize
pub fn stored_count(&self) -> usize
Return the number of events currently stored.
Sourcepub fn total_count(&self) -> usize
pub fn total_count(&self) -> usize
Return the total number of events logged (including overwritten ones).
Sourcepub fn drain_ordered(&self) -> Vec<&TraceEvent>
pub fn drain_ordered(&self) -> Vec<&TraceEvent>
Drain events in order (oldest first).
Auto Trait Implementations§
impl Freeze for RingTracer
impl RefUnwindSafe for RingTracer
impl Send for RingTracer
impl Sync for RingTracer
impl Unpin for RingTracer
impl UnsafeUnpin for RingTracer
impl UnwindSafe for RingTracer
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