Struct PspLoggerConfig

Source
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

Source

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.
Source

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.

Source

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.

Source

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.

Source

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.

Source

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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.