# tracing::subscriber::set_default - Rust
API documentation for the Rust `set_default` fn in crate `tracing`.
Keywords: rust, rustlang, rust-lang, set_default

# Function tracing::subscriber::set_default [−] [src]

    #[must_use = "Dropping the guard unregisters the subscriber."]pub fn set_default<S>(subscriber: S) -> DefaultGuard where
        S: Subscriber + Send + Sync + 'static,

Sets the subscriber as the default for the duration of the lifetime of the returned `DefaultGuard`

The default subscriber is used when creating a new `Span` or `Event`, if no span is currently executing. If a span is currently executing, new spans or events are dispatched to the subscriber that tagged that span, instead.