pub struct Logger<'a, S: LogSink> { /* private fields */ }Expand description
A tiny logger with level filtering.
Logger formats each line as:
[Level] message\nIt is intentionally synchronous and allocation-free.
Implementations§
Source§impl<'a, S: LogSink> Logger<'a, S>
impl<'a, S: LogSink> Logger<'a, S>
Sourcepub fn new(sink: &'a mut S, level: Level) -> Self
pub fn new(sink: &'a mut S, level: Level) -> Self
Creates a new logger writing to sink and filtering at level.
Sourcepub fn sink_mut(&mut self) -> &mut S
pub fn sink_mut(&mut self) -> &mut S
Returns a mutable reference to the underlying sink.
This is useful when you need to flush or reconfigure the device.
Auto Trait Implementations§
impl<'a, S> Freeze for Logger<'a, S>
impl<'a, S> RefUnwindSafe for Logger<'a, S>where
S: RefUnwindSafe,
impl<'a, S> Send for Logger<'a, S>where
S: Send,
impl<'a, S> Sync for Logger<'a, S>where
S: Sync,
impl<'a, S> Unpin for Logger<'a, S>
impl<'a, S> UnsafeUnpin for Logger<'a, S>
impl<'a, S> !UnwindSafe for Logger<'a, S>
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