pub struct Config { /* private fields */ }
Expand description
Builder style configuration for the serif
tracing-subscriber implementation.
Implementations§
source§impl Config
impl Config
sourcepub fn with_output(self, output: Output) -> Self
pub fn with_output(self, output: Output) -> Self
Change the output destination to stdout or stderr. The default is stdout.
sourcepub fn with_color(self, color: ColorMode) -> Self
pub fn with_color(self, color: ColorMode) -> Self
Enable or disable ANSI coloring. The default is ColorMode::Auto
.
sourcepub fn with_default(self, default: impl Into<Directive>) -> Self
pub fn with_default(self, default: impl Into<Directive>) -> Self
Set the default log directive. The default is the INFO level.
You can call this with tracing::Level
and tracing_subscriber::filter::LevelFilter
,
since those types implement Into<Directive>
.
sourcepub fn with_verbosity(self, verbosity: i32) -> Self
pub fn with_verbosity(self, verbosity: i32) -> Self
Set the default log level using a numberic “verbosity” value.
Applications can use this to easily turn the count of command line flags (e.g. --verbose
or --quiet
) into a default log level. This method does the same thing as
Config::with_default
and it makes no sense to combine them.
The mapping of verbosity levels to log levels is:
-3
or less: off (no logs enabled)-2
: error-1
: warning0
: info1
: debug2
or greater: trace
sourcepub fn with_timestamp(self, time_format: TimeFormat) -> Self
pub fn with_timestamp(self, time_format: TimeFormat) -> Self
Set the timestamp format for this Config.
sourcepub fn with_target(self, display_target: bool) -> Self
pub fn with_target(self, display_target: bool) -> Self
Set whether or not an event’s target is displayed.
sourcepub fn with_scope(self, display_scope: bool) -> Self
pub fn with_scope(self, display_scope: bool) -> Self
Set whether or not an event’s span scope is displayed.
sourcepub fn init(self)
pub fn init(self)
Finalize this Config and register it as the global default tracing subscriber.
§Panics
Panics if the RUST_LOG
environment variable is invalid (see make_env_filter
) or if
another global subscriber is already installed (see SubscriberBuilder::init
).