NonBlockingLoggerBuilder

Struct NonBlockingLoggerBuilder 

Source
pub struct NonBlockingLoggerBuilder { /* private fields */ }

Implementations§

Source§

impl NonBlockingLoggerBuilder

Source

pub fn new() -> Self

Examples found in repository?
examples/test.rs (line 4)
3fn main() {
4    let logger = NonBlockingLoggerBuilder::new().init().unwrap();
5
6    log::warn!("This is an example message.");
7
8    let large_string =
9        "[super large message that should crash fd in non blocking mode]".repeat(100000);
10    log::warn!("{}", large_string);
11    log::logger().flush();
12
13    log::warn!("This is an example message.");
14    log::logger().flush();
15
16    logger.shutdown().unwrap();
17}
Source

pub fn with_module_level(self, target: &str, level: LevelFilter) -> Self

Source

pub fn with_colors(self, colors: bool) -> Self

Control whether messages are colored or not.

This method is only available if the colored feature is enabled.

Source

pub fn without_timestamps(self) -> Self

Don’t display any timestamps.

This method is only available if the timestamps feature is enabled.

Source

pub fn with_utc_timestamps(self) -> Self

Display timestamps using UTC.

This method is only available if the timestamps feature is enabled.

Source

pub fn with_utc_offset(self, offset: UtcOffset) -> Self

Display timestamps using a static UTC offset.

This method is only available if the timestamps feature is enabled.

Source

pub fn with_timestamp_format( self, format: &'static [FormatItem<'static>], ) -> Self

Control the format used for timestamps.

Without this, a default format is used depending on the timestamps type.

The syntax for the format_description macro can be found in the time crate book.

Source

pub fn init(self) -> Result<NonBlockingLogger, SetLoggerError>

Examples found in repository?
examples/test.rs (line 4)
3fn main() {
4    let logger = NonBlockingLoggerBuilder::new().init().unwrap();
5
6    log::warn!("This is an example message.");
7
8    let large_string =
9        "[super large message that should crash fd in non blocking mode]".repeat(100000);
10    log::warn!("{}", large_string);
11    log::logger().flush();
12
13    log::warn!("This is an example message.");
14    log::logger().flush();
15
16    logger.shutdown().unwrap();
17}

Trait Implementations§

Source§

impl Default for NonBlockingLoggerBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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.