开源项目 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-APACHE
和LICENSE-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