Skip to main content

Crate reth_tracing

Crate reth_tracing 

Source
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;std
pub use log_handle::log_handle_available;std
pub use log_handle::set_log_verbosity;std
pub use log_handle::set_log_vmodule;std
pub use log_handle::LogFilterReloadHandle;std
pub use tracing;
pub use tracing_appender;std
pub use tracing_subscriber;std

Modules§

log_handlestd
Global log handle for runtime filter changes.

Macros§

throttlestd
Throttles the execution of an expression to run at most once per specified duration.

Structs§

FileInfostd
Holds configuration information for file logging.
LayerInfostd
Configuration for a logging layer.
Layersstd
Manages the collection of layers for a tracing subscriber.
RethTracerstd
Tracer for application logging.
TestTracerstd
Initializes a tracing subscriber for tests.

Enums§

LogFormatstd
Represents the logging format.

Traits§

Tracerstd
Trait defining a general interface for logging configuration.

Functions§

init_test_tracingstd
Initializes a tracing subscriber for tests.

Type Aliases§

FileWorkerGuardstd
A worker guard returned by the file layer.