init_tracing

Function init_tracing 

Source
pub fn init_tracing()
Expand description

Initialize tracing with recommended defaults for rust-rabbit.

This sets up tracing with the following filters:

  • info level for general application logs
  • warn level for lapin (RabbitMQ client) to suppress spurious ERROR logs from io_loop

You can override the filter using the RUST_LOG environment variable.

§Example

use rust_rabbit::init_tracing;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Initialize tracing with recommended settings
    init_tracing();
     
    // Your application code
    Ok(())
}

§Custom Configuration

To use custom log levels, set the RUST_LOG environment variable:

RUST_LOG=debug,lapin=warn cargo run