#[non_exhaustive]pub struct ConfigBuilder(/* private fields */);
Expand description
Builder for the Logger Configurations (Config
)
All loggers print the message in the following form:
00:00:00 [LEVEL] crate::module: [lib.rs::100] your_message
Every space delimited part except the actual message is optional.
Use this struct to create a custom Config
changing when these information shall
be logged. Every part can be enabled for a specific Level and is then
automatically enable for all lower levels as well.
The Result is that the logging gets more detailed the more verbose it gets.
E.g. to have one part shown always use Level::Error
. But if you
want to show the source line only on Trace
use that.
Implementations§
Source§impl ConfigBuilder
impl ConfigBuilder
Sourcepub fn new() -> ConfigBuilder
pub fn new() -> ConfigBuilder
Create a new default ConfigBuilder
Sourcepub fn set_max_level(&mut self, level: LevelFilter) -> &mut ConfigBuilder
pub fn set_max_level(&mut self, level: LevelFilter) -> &mut ConfigBuilder
Set at which level and above (more verbose) the level itself shall be logged (default is Error)
Sourcepub fn set_time_level(&mut self, time: LevelFilter) -> &mut ConfigBuilder
pub fn set_time_level(&mut self, time: LevelFilter) -> &mut ConfigBuilder
Set at which level and above (more verbose) the current time shall be logged (default is Error)
Sourcepub fn set_thread_level(&mut self, thread: LevelFilter) -> &mut ConfigBuilder
pub fn set_thread_level(&mut self, thread: LevelFilter) -> &mut ConfigBuilder
Set at which level and above (more verbose) the thread id shall be logged. (default is Debug)
Sourcepub fn set_target_level(&mut self, target: LevelFilter) -> &mut ConfigBuilder
pub fn set_target_level(&mut self, target: LevelFilter) -> &mut ConfigBuilder
Set at which level and above (more verbose) the target shall be logged. (default is Debug)
Sourcepub fn set_location_level(
&mut self,
location: LevelFilter,
) -> &mut ConfigBuilder
pub fn set_location_level( &mut self, location: LevelFilter, ) -> &mut ConfigBuilder
Set at which level and above (more verbose) a source code reference shall be logged (default is Trace)
Sourcepub fn set_level_padding(&mut self, padding: LevelPadding) -> &mut ConfigBuilder
pub fn set_level_padding(&mut self, padding: LevelPadding) -> &mut ConfigBuilder
Set how the levels should be padded, when logging (default is Off)
Sourcepub fn set_thread_padding(
&mut self,
padding: ThreadPadding,
) -> &mut ConfigBuilder
pub fn set_thread_padding( &mut self, padding: ThreadPadding, ) -> &mut ConfigBuilder
Set how the thread should be padded
Sourcepub fn set_thread_mode(&mut self, mode: ThreadLogMode) -> &mut ConfigBuilder
pub fn set_thread_mode(&mut self, mode: ThreadLogMode) -> &mut ConfigBuilder
Set the mode for logging the thread
Sourcepub fn set_level_color(
&mut self,
level: Level,
color: Option<Color>,
) -> &mut ConfigBuilder
pub fn set_level_color( &mut self, level: Level, color: Option<Color>, ) -> &mut ConfigBuilder
Set the color used for printing the level (if the logger supports it), or None to use the default foreground color
Sourcepub fn set_time_format_str(
&mut self,
time_format: &'static str,
) -> &mut ConfigBuilder
pub fn set_time_format_str( &mut self, time_format: &'static str, ) -> &mut ConfigBuilder
Set time chrono strftime format string.
Sourcepub fn set_time_format(&mut self, time_format: String) -> &mut ConfigBuilder
pub fn set_time_format(&mut self, time_format: String) -> &mut ConfigBuilder
Set time chrono strftime format string.
Sourcepub fn set_time_offset(
&mut self,
time_offset: FixedOffset,
) -> &mut ConfigBuilder
pub fn set_time_offset( &mut self, time_offset: FixedOffset, ) -> &mut ConfigBuilder
Set offset used for logging time (default is 0)
Sourcepub fn set_time_to_local(&mut self, local: bool) -> &mut ConfigBuilder
pub fn set_time_to_local(&mut self, local: bool) -> &mut ConfigBuilder
set if you log in local timezone or UTC (default is UTC)
Sourcepub fn add_filter_allow_str(
&mut self,
filter_allow: &'static str,
) -> &mut ConfigBuilder
pub fn add_filter_allow_str( &mut self, filter_allow: &'static str, ) -> &mut ConfigBuilder
Add allowed module filters. If any are specified, only records from modules starting with one of these entries will be printed
For example, add_filter_allow_str("tokio::uds")
would allow only logging from the tokio
crates uds
module.
Sourcepub fn add_filter_allow(&mut self, filter_allow: String) -> &mut ConfigBuilder
pub fn add_filter_allow(&mut self, filter_allow: String) -> &mut ConfigBuilder
Add allowed module filters. If any are specified, only records from modules starting with one of these entries will be printed
For example, add_filter_allow(format!("{}{}","tokio", "uds"))
would allow only logging from the tokio
crates uds
module.
Sourcepub fn clear_filter_allow(&mut self) -> &mut ConfigBuilder
pub fn clear_filter_allow(&mut self) -> &mut ConfigBuilder
Clear allowed module filters. If none are specified, nothing is filtered out
Sourcepub fn add_filter_ignore_str(
&mut self,
filter_ignore: &'static str,
) -> &mut ConfigBuilder
pub fn add_filter_ignore_str( &mut self, filter_ignore: &'static str, ) -> &mut ConfigBuilder
Add denied module filters. If any are specified, records from modules starting with one of these entries will be ignored
For example, add_filter_ignore_str("tokio::uds")
would deny logging from the tokio
crates uds
module.
Sourcepub fn add_filter_ignore(&mut self, filter_ignore: String) -> &mut ConfigBuilder
pub fn add_filter_ignore(&mut self, filter_ignore: String) -> &mut ConfigBuilder
Add denied module filters. If any are specified, records from modules starting with one of these entries will be ignored
For example, add_filter_ignore(format!("{}{}","tokio", "uds"))
would deny logging from the tokio
crates uds
module.
Sourcepub fn clear_filter_ignore(&mut self) -> &mut ConfigBuilder
pub fn clear_filter_ignore(&mut self) -> &mut ConfigBuilder
Clear ignore module filters. If none are specified, nothing is filtered
Trait Implementations§
Source§impl Clone for ConfigBuilder
impl Clone for ConfigBuilder
Source§fn clone(&self) -> ConfigBuilder
fn clone(&self) -> ConfigBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for ConfigBuilder
impl Debug for ConfigBuilder
Auto Trait Implementations§
impl Freeze for ConfigBuilder
impl RefUnwindSafe for ConfigBuilder
impl Send for ConfigBuilder
impl Sync for ConfigBuilder
impl Unpin for ConfigBuilder
impl UnwindSafe for ConfigBuilder
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)