🛈 Note: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem.

For the release documentation, please see docs.rs, instead.

tracing::dispatch

Function set_global_default

Source
pub fn set_global_default(
    dispatcher: Dispatch,
) -> Result<(), SetGlobalDefaultError>
Expand description

Sets this dispatch as the global default for the duration of the entire program. Will be used as a fallback if no thread-local dispatch has been set in a thread (using with_default.)

Can only be set once; subsequent attempts to set the global default will fail. Returns Err if the global default has already been set.

Warning: In general, libraries should not call
set_global_default()! Doing so will cause conflicts when
executables that depend on the library try to set the default collector later.