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

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

tracing::collect

Function set_global_default

Source
pub fn set_global_default<C>(collector: C) -> Result<(), SetGlobalDefaultError>
where C: Collect + Send + Sync + 'static,
Available on crate features std or alloc only.
Expand description

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

Can only be set once; subsequent attempts to set the global default will fail. Returns whether the initialization was successful.

Note: Libraries should NOT call set_global_default()! That will cause conflicts when executables try to set them later.