API Reference

tracing-subscriber

Utilities for composing tracing subscribers in Rust, including filtering and formatting layers.

Official Documentation ↗
CompatibilityThis documentation covers version v0.3. Check the official docs for the latest API surface.

Installation

cargocargo add tracing-subscriber

Methods

tracing-subscriber filters, formats, and routes tracing events and spans to outputs.

Key Features

  • EnvFilter directives from environment
  • Human and JSON formatting layers
  • Layered composition of subscribers

Usage Notes

Pin a version and check the official docs for the API surface you depend on before upgrading.

Errors

The official API reference declares the following error types:

API reference evidence

Fetched from official sources on 2026-11-08T19:20:00+08:00 via WebFetch https://docs.rs/tracing-subscriber/latest/tracing_subscriber/fmt/struct.SubscriberBuilder.html;WebFetch https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html.

FAQ

How do I filter without RUST_LOG?
Build an EnvFilter from a literal directive string with EnvFilter::new("info,my_crate=debug").
Can I combine a formatter and a filter?
Yes. Use the builder chain to attach with_env_filter and json on the same fmt subscriber.
How do spans get recorded?
Spans are tracked by the subscriber; the fmt layer includes span context on each event it prints.