Trait sdre_rust_logging::SetupLogging
source · pub trait SetupLogging {
// Required methods
fn set_logging_level(self) -> LevelFilter;
fn enable_logging(&self);
}
Expand description
Trait to setup logging
To initialize logging, call enable_logging
on a u8
Required Methods§
sourcefn set_logging_level(self) -> LevelFilter
fn set_logging_level(self) -> LevelFilter
Set logging level. The logging levels match up to the
log crate’s levels. If the user does not specify
one of these, it defaults to info.
to set the logging level, call set_logging_level
on a u8
Once set, users will be shown messages at the current level and lower only
High levels are suppressed. For example, if the level is set to info, users will see
info, warn, and error messages. They will not see debug or trace messages.
sourcefn enable_logging(&self)
fn enable_logging(&self)
Enable logging
The output is colored and looks like this:
[INFO ][2021-08-22T15:49:01]This is an info message
[DEBUG][2021-08-22T15:49:01]This is a debug message
[TRACE][2021-08-22T15:49:01]This is a trace message
[ERROR][2021-08-22T15:49:01]This is an error message
[WARN ][2021-08-22T15:49:01]This is a warning message
[OTHER][2021-08-22T15:49:01]This is a message with a different log level
The level field is colored and bold if the terminal supports it.