7 个不稳定版本 (3 个破坏性更新)
0.4.0 | 2024年4月12日 |
---|---|
0.3.0 | 2023年8月7日 |
0.2.3 |
|
0.2.2 | 2022年10月27日 |
0.1.1 | 2021年12月1日 |
#50 在 日期和时间 中
每月4,298次下载
用于 5 crates
36KB
650 行
tracing-glog
tracing-glog
是一个 glog 启发式的 tracing-subscriber
格式化器。
tracing-glog
应与 tracing-subscriber
一起使用,因为它是一个格式化器,允许 tracing-subscriber
的 fmt::Subscriber
和 fmt::Layer
以 glog 启发式的方式格式化事件。
示例
use tracing_glog::{Glog, GlogFields};
tracing_subscriber::fmt()
.event_format(Glog::default())
.fmt_fields(GlogFields::default())
.init();
使用 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");
依赖项
~2.4–9MB
~54K SLoC