pub struct Logger<'o> { /* private fields */ }
Expand description
A logger that can log messages on different level to different output.
The output of each level can be configured to eventually be same for all, or unique.
Implementations§
Source§impl<'o> Logger<'o>
impl<'o> Logger<'o>
Sourcepub fn new() -> Option<Self>
pub fn new() -> Option<Self>
Create a new logger.
By default, INFO
and DEBUG
are writting to stdout
,
and WARNING
and ERROR
write to stderr
.
§Return Value
The new logger if the function succeeded, None
otherwise.
Sourcepub fn config_format<S: ToString + ?Sized>(&mut self, new_format: &S)
pub fn config_format<S: ToString + ?Sized>(&mut self, new_format: &S)
Configure the format of the log.
§Arguments
new_format
- The format to be used for logging message.
Any occurrence of%l
will be replaced by the level,%t
by the timestamp,%m
by the message.
Sourcepub fn config_info(&mut self, kind: OutputKind<'o>)
pub fn config_info(&mut self, kind: OutputKind<'o>)
Sourcepub fn config_debug(&mut self, kind: OutputKind<'o>)
pub fn config_debug(&mut self, kind: OutputKind<'o>)
Sourcepub fn config_warning(&mut self, kind: OutputKind<'o>)
pub fn config_warning(&mut self, kind: OutputKind<'o>)
Sourcepub fn config_error(&mut self, kind: OutputKind<'o>)
pub fn config_error(&mut self, kind: OutputKind<'o>)
Auto Trait Implementations§
impl<'o> Freeze for Logger<'o>
impl<'o> !RefUnwindSafe for Logger<'o>
impl<'o> !Send for Logger<'o>
impl<'o> !Sync for Logger<'o>
impl<'o> Unpin for Logger<'o>
impl<'o> !UnwindSafe for Logger<'o>
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