tracing-glog

Crates.iotracing-glog
lib.rstracing-glog
version0.4.0
sourcesrc
created_at2021-12-01 01:39:25.03306
updated_at2024-04-12 15:37:59.576353
descriptiona glog-inspired formatter for tracing-subscriber
homepagehttps://github.com/davidbarsky/tracing-glog
repositoryhttps://github.com/davidbarsky/tracing-glog
max_upload_size
id490061
size78,801
crate-publishers (github:build-trust:crate-publishers)

documentation

https://docs.rs/tracing-glog

README

tracing-glog

tracing-glog is a glog-inspired formatter for tracing-subscriber.

tracing-glog should be used with tracing-subscriber, as it is a formatter that tracing-subscriber's fmt::Subscriber and fmt::Layer can use to format events in a glog-inspired fashion.

Examples

With fmt::Subscriber:

use tracing_glog::{Glog, GlogFields};

tracing_subscriber::fmt()
    .event_format(Glog::default())
    .fmt_fields(GlogFields::default())
    .init();

With tracing_subscriber::fmt::Layer:

use tracing_subscriber::prelude::*;
use tracing_subscriber::{fmt, Registry};
use tracing_glog::{Glog, GlogFields};

let fmt = fmt::Layer::default()
    .event_format(Glog::default())
    .fmt_fields(GlogFields::default());

let subscriber = Registry::default().with(fmt);
tracing::subscriber::set_global_default(subscriber).expect("Unable to set global subscriber");
Commit count: 28

cargo fmt