开源项目 `tracing` 使用教程

开源项目 tracing 使用教程

tracingApplication level tracing for Rust.项目地址:https://gitcode.com/gh_mirrors/tr/tracing

1. 项目的目录结构及介绍

tracing 项目的目录结构如下:

tracing/
├── Cargo.toml
├── LICENSE-APACHE
├── LICENSE-MIT
├── README.md
├── benches/
├── examples/
├── src/
│   ├── lib.rs
│   ├── subscriber.rs
│   ├── field.rs
│   ├── span.rs
│   ├── metadata.rs
│   ├── event.rs
│   ├── dispatch.rs
│   ├── subscriber/
│   ├── layer.rs
│   ├── macros.rs
│   ├── value.rs
│   ├── support.rs
│   ├── test.rs
│   └── fmt/
├── tracing-attributes/
│   ├── Cargo.toml
│   ├── src/
│   │   └── lib.rs
│   └── tests/
├── tracing-core/
│   ├── Cargo.toml
│   ├── src/
│   │   └── lib.rs
│   └── tests/
├── tracing-futures/
│   ├── Cargo.toml
│   ├── src/
│   │   └── lib.rs
│   └── tests/
├── tracing-log/
│   ├── Cargo.toml
│   ├── src/
│   │   └── lib.rs
│   └── tests/
├── tracing-subscriber/
│   ├── Cargo.toml
│   ├── src/
│   │   └── lib.rs
│   └── tests/
└── tracing-appender/
    ├── Cargo.toml
    ├── src/
    │   └── lib.rs
    └── tests/

目录结构介绍

  • Cargo.toml: 项目的依赖管理文件。
  • LICENSE-APACHELICENSE-MIT: 项目的许可证文件。
  • README.md: 项目的介绍文档。
  • benches/: 包含性能测试代码。
  • examples/: 包含示例代码。
  • src/: 包含项目的主要源代码。
    • lib.rs: 项目的主库文件。
    • subscriber.rs, field.rs, span.rs, metadata.rs, event.rs, dispatch.rs, layer.rs, macros.rs, value.rs, support.rs, test.rs: 各个模块的源代码文件。
    • fmt/: 格式化相关的代码。
  • tracing-attributes/, tracing-core/, tracing-futures/, tracing-log/, tracing-subscriber/, tracing-appender/: 项目的各个子模块。

2. 项目的启动文件介绍

tracing 项目的启动文件是 src/lib.rs。这个文件定义了项目的主要结构和入口点。它导入了其他模块,并提供了一些基本的函数和宏。

// src/lib.rs

//! `tracing` is a framework for instrumenting Rust programs to collect
//! structured, event-based diagnostic information.

#![cfg_attr(feature = "cargo-clippy", allow(clippy::cognitive_complexity))]
#![doc(html_root_url = "https://docs.rs/tracing/0.1.29")]
#![deny(missing_debug_implementations, missing_docs)]
// `pub(crate)` items are not publicly documented, so don't require docs.
#![allow(unused_imports)]

pub use self::span::{Instrument, Instrumented};
pub use self::subscriber::{self, Subscribe, Subscriber};
pub use self::event::Event;
pub use self::field::{Field, Visit};
pub use self::metadata::{Metadata, Kind};
pub use self::dispatch::Dispatch;
pub use self::layer::{self, Layer};
pub use self::macros::*;
pub use self::value::Value;
pub use self::support::{self, *};
pub use self::test::{self, *};

mod span;
mod subscriber;
mod event;
mod field;
mod metadata;
mod dispatch;
mod layer;
mod macros;
mod value;
mod support;
mod test;

3. 项目的配置文件介绍

tracing 项目的主要配置文件是 Cargo.toml。这个文件定义了项目的依赖、版本、特性等信息。

tracingApplication level tracing for Rust.项目地址:https://gitcode.com/gh_mirrors/tr/tracing

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

盛言蓓Juliana

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值