2 releases
| 0.1.1 | Jan 26, 2026 |
|---|---|
| 0.1.0 | Oct 26, 2025 |
#749 in Debugging
2,596 downloads per month
48KB
796 lines
tracing-flat-json
A simple tracing_subscriber::Layer emitting newline-delimited JSON, with
all event and span fields flattened onto the top level JSON object. Similar
to combining the json-subscriber options with_flattened_event and
with_top_level_flattened_span_list, without the caveats about duplicate
fields noted in the documentation for those options.
Usage
use tracing_subscriber::prelude::*;
tracing_subscriber::Registry::default()
.with(tracing_flat_json::FlatJsonLayer::new(std::io::stdout))
.init();
Feature Flags
tracing-log: Handlelogevents emitted bytracing-log. Enabled by default.tracing-opentelemetry: Outputs thetrace_idadded to spans bytracing-opentelemetry. May not work when compiled with multiple versions oftracing-opentelemetryin the same executable.
Output Format
Included:
- timestamp (RFC3339 UTC)
- level
trace_id(with featuretracing-opentelemetry)code.file.pathcode.line.number- event message
- event fields, source code order
- parent span fields, source code order, latest span first, root span last
Excluded:
- span names
targetspan_id- duplicate fields (only latest value for each field name)
Dependencies
~7–10MB
~106K SLoC