tracing-flat-json 0.1.1

A simple tracing-subscriber Layer emitting newline-delimited JSON.
Documentation

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

Output Format

Included:

  • timestamp (RFC3339 UTC)
  • level
  • trace_id (with feature tracing-opentelemetry)
  • code.file.path
  • code.line.number
  • event message
  • event fields, source code order
  • parent span fields, source code order, latest span first, root span last

Excluded:

  • span names
  • target
  • span_id
  • duplicate fields (only latest value for each field name)