pub struct PspLoggerConfig { /* private fields */ }
Expand description
Configuration for the logger.
§Examples
// Create logger for Debug and up.
// All logs will be written to stderr.
let config = psp_logger::PspLoggerConfig::new(log::LevelFilter::Debug);
let _ = psp_logger::PspLogger::init(config);
debug!("I'm a debug log!");
// Create logger for Info and up.
// Info logs will go to stdout, the rest will go to stderr.
let config = psp_logger::PspLoggerConfig::new(log::LevelFilter::Info)
.with_info_stream(psp_logger::OutputStream::StdOut);
let _ = psp_logger::PspLogger::init(config);
info!("I'm an info log!");
Implementations§
Source§impl PspLoggerConfig
impl PspLoggerConfig
Sourcepub fn new(level_filter: LevelFilter) -> Self
pub fn new(level_filter: LevelFilter) -> Self
Constructs a new PspLoggerConfig.
All log levels will initially be mapped to stderr.
Use the with_*_stream
methods on the returned struct to change this.
§Arguments
level_filter
: Filter to control which log levels are actually logged.
Sourcepub fn with_error_stream(self, stream: OutputStream) -> Self
pub fn with_error_stream(self, stream: OutputStream) -> Self
Map the error log level to an OutputStream
Returns the struct to allow the method to be chained.
Sourcepub fn with_warn_stream(self, stream: OutputStream) -> Self
pub fn with_warn_stream(self, stream: OutputStream) -> Self
Map the warn log level to an OutputStream
Returns the struct to allow the method to be chained.
Sourcepub fn with_info_stream(self, stream: OutputStream) -> Self
pub fn with_info_stream(self, stream: OutputStream) -> Self
Map the info log level to an OutputStream
Returns the struct to allow the method to be chained.
Sourcepub fn with_debug_stream(self, stream: OutputStream) -> Self
pub fn with_debug_stream(self, stream: OutputStream) -> Self
Map the debug log level to an OutputStream
Returns the struct to allow the method to be chained.
Sourcepub fn with_trace_stream(self, stream: OutputStream) -> Self
pub fn with_trace_stream(self, stream: OutputStream) -> Self
Map the trace log level to an OutputStream
Returns the struct to allow the method to be chained.
Auto Trait Implementations§
impl Freeze for PspLoggerConfig
impl RefUnwindSafe for PspLoggerConfig
impl Send for PspLoggerConfig
impl Sync for PspLoggerConfig
impl Unpin for PspLoggerConfig
impl UnwindSafe for PspLoggerConfig
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