mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
feat: add tracing crate (#236)
This commit is contained in:
8
Cargo.lock
generated
8
Cargo.lock
generated
@ -3459,6 +3459,14 @@ dependencies = [
|
||||
"tracing-futures",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "reth-tracing"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"tracing",
|
||||
"tracing-subscriber",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "reth-transaction-pool"
|
||||
version = "0.1.0"
|
||||
|
||||
@ -21,9 +21,10 @@ members = [
|
||||
"crates/net/bodies-downloaders",
|
||||
"crates/primitives",
|
||||
"crates/stages",
|
||||
"crates/tracing",
|
||||
"crates/transaction-pool",
|
||||
"crates/db",
|
||||
"crates/libmdbx-rs",
|
||||
"crates/libmdbx-rs/mdbx-sys"
|
||||
"crates/libmdbx-rs/mdbx-sys",
|
||||
]
|
||||
default-members = ["bin/reth"]
|
||||
|
||||
12
crates/tracing/Cargo.toml
Normal file
12
crates/tracing/Cargo.toml
Normal file
@ -0,0 +1,12 @@
|
||||
[package]
|
||||
name = "reth-tracing"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
license = "MIT OR Apache-2.0"
|
||||
repository = "https://github.com/foundry-rs/reth"
|
||||
readme = "README.md"
|
||||
description = "tracing helpers"
|
||||
|
||||
[dependencies]
|
||||
tracing = { version = "0.1", default-features = false }
|
||||
tracing-subscriber = { version = "0.3", default-features = false, features = ["env-filter", "fmt"] }
|
||||
22
crates/tracing/src/lib.rs
Normal file
22
crates/tracing/src/lib.rs
Normal file
@ -0,0 +1,22 @@
|
||||
#![warn(missing_docs, unreachable_pub)]
|
||||
#![deny(unused_must_use, rust_2018_idioms)]
|
||||
#![doc(test(
|
||||
no_crate_inject,
|
||||
attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables))
|
||||
))]
|
||||
|
||||
//! reth-tracing
|
||||
|
||||
// re-export tracing crates.
|
||||
pub use tracing;
|
||||
pub use tracing_subscriber;
|
||||
|
||||
/// Initialises a tracing subscriber via `RUST_LOG` environment variable filter.
|
||||
///
|
||||
/// Note: This ignores any error and should be used for testing.
|
||||
pub fn init_tracing() {
|
||||
let _ = tracing_subscriber::fmt()
|
||||
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
|
||||
.with_writer(std::io::stderr)
|
||||
.try_init();
|
||||
}
|
||||
Reference in New Issue
Block a user