Skip to main content

json

Function json 

Source
pub fn json<W>(writer: W) -> Json<W>
where W: for<'w> MakeWriter<'w> + 'static,
Expand description

A layer writing every event as a JSON object on its own line: ts, level, target, then cause - the point an application’s own event happened under - then the event’s fields with their own types.

use tracing_subscriber::prelude::*;

let log = std::fs::File::create("app.log").unwrap();
tracing_subscriber::registry()
    .with(guinea_trace::json(log))
    .init();