[][src]Struct log_rs::Logger

pub struct Logger<'o> { /* fields omitted */ }

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.

Methods

impl<'o> Logger<'o>[src]

pub fn new() -> Option<Self>[src]

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.

pub fn config_format<S: ToString + ?Sized>(&mut self, new_format: &S)[src]

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.

pub fn config_info(&mut self, kind: OutputKind<'o>)[src]

Configure the output for INFO.

Arguments

  • kind - The new output kind to be used by the info.

pub fn config_debug(&mut self, kind: OutputKind<'o>)[src]

Configure the output for DEBUG.

Arguments

  • kind - The new output kind to be used by the debug.

pub fn config_warning(&mut self, kind: OutputKind<'o>)[src]

Configure the output for WARNING.

Arguments

  • kind - The new output kind to be used by the warning.

pub fn config_error(&mut self, kind: OutputKind<'o>)[src]

Configure the output for ERROR.

Arguments

  • kind - The new output kind to be used by the error.

pub fn info(&mut self, msg: &str)[src]

Send a message on INFO.

Arguments

  • msg - The message to write on INFO.

pub fn debug(&mut self, msg: &str)[src]

Send a message on DEBUG.

Arguments

  • msg - The message to write on DEBUG.

pub fn warning(&mut self, msg: &str)[src]

Send a message on WARNING.

Arguments

  • msg - The message to write on WARNING.

pub fn error(&mut self, msg: &str)[src]

Send a message on ERROR.

Arguments

  • msg - The message to write on ERROR.

Auto Trait Implementations

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.