Crate tracing_tape_recorder

Crate tracing_tape_recorder 

Source
Expand description

§Tracing Tape Recorder

This crate provides a tracing subscriber layer that records tracing events to a file in the tracing-tape format.

§Setup

First, add the the tracing, tracing-subscriber, and tracing-tape-recorder dependencies to your application:

cargo add tracing tracing-subscriber tracing-tape-recorder

Then, you can use the TapeRecorder layer in your application:

use tracing::trace_span;
use tracing_subscriber::{fmt, layer::SubscriberExt, Registry};
use tracing_tape_recorder::TapeRecorder;

let subscriber = Registry::default().with(TapeRecorder::default());
let guard = tracing::subscriber::set_default(subscriber);

// ...

drop(guard);

This will create a new *.tape file in the current working directory with the name based on the executable name and the current time. This file can be viewed using the trace-deck which is available online or can be installed locally using

cargo install trace-deck

Have a look at the getting stated guide for more information.

Structs§

TapeRecorder