Expand description
The tracing module provides functionalities for setting up and configuring logging.
It includes structures and functions to create and manage various logging layers: stdout,
file, or journald. The module’s primary entry point is the Tracer struct, which can be
configured to use different logging formats and destinations. If no layer is specified, it will
default to stdout.
§Examples
Basic usage:
use reth_tracing::{
LayerInfo, RethTracer, Tracer,
tracing::level_filters::LevelFilter,
LogFormat,
};
fn main() -> eyre::Result<()> {
let tracer = RethTracer::new().with_stdout(LayerInfo::new(
LogFormat::Json,
LevelFilter::INFO.to_string(),
"debug".to_string(),
None,
));
tracer.init()?;
// Your application logic here
Ok(())
}This example sets up a tracer with JSON format logging to stdout.
Re-exports§
pub use log_handle::install_log_handle;stdpub use log_handle::log_handle_available;stdpub use log_handle::set_log_verbosity;stdpub use log_handle::set_log_vmodule;stdpub use log_handle::LogFilterReloadHandle;stdpub use tracing;pub use tracing_appender;stdpub use tracing_subscriber;std
Modules§
- log_
handle std - Global log handle for runtime filter changes.
Macros§
- throttle
std - Throttles the execution of an expression to run at most once per specified duration.
Structs§
- File
Info std - Holds configuration information for file logging.
- Layer
Info std - Configuration for a logging layer.
- Layers
std - Manages the collection of layers for a tracing subscriber.
- Reth
Tracer std - Tracer for application logging.
- Test
Tracer std - Initializes a tracing subscriber for tests.
Enums§
- LogFormat
std - Represents the logging format.
Traits§
- Tracer
std - Trait defining a general interface for logging configuration.
Functions§
- init_
test_ tracing std - Initializes a tracing subscriber for tests.
Type Aliases§
- File
Worker Guard std - A worker guard returned by the file layer.