pub struct NonBlockingLoggerBuilder { /* private fields */ }Implementations§
Source§impl NonBlockingLoggerBuilder
impl NonBlockingLoggerBuilder
Sourcepub fn new() -> Self
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}pub fn with_module_level(self, target: &str, level: LevelFilter) -> Self
Sourcepub fn with_colors(self, colors: bool) -> Self
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.
Sourcepub fn without_timestamps(self) -> Self
pub fn without_timestamps(self) -> Self
Don’t display any timestamps.
This method is only available if the timestamps feature is enabled.
Sourcepub fn with_utc_timestamps(self) -> Self
pub fn with_utc_timestamps(self) -> Self
Display timestamps using UTC.
This method is only available if the timestamps feature is enabled.
Sourcepub fn with_utc_offset(self, offset: UtcOffset) -> Self
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.
Sourcepub fn with_timestamp_format(
self,
format: &'static [FormatItem<'static>],
) -> Self
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.
Sourcepub fn init(self) -> Result<NonBlockingLogger, SetLoggerError>
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§
Auto Trait Implementations§
impl Freeze for NonBlockingLoggerBuilder
impl RefUnwindSafe for NonBlockingLoggerBuilder
impl Send for NonBlockingLoggerBuilder
impl Sync for NonBlockingLoggerBuilder
impl Unpin for NonBlockingLoggerBuilder
impl UnwindSafe for NonBlockingLoggerBuilder
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