From 2f682555a8f5ccdf64438d1da4a070f7c6aa2475 Mon Sep 17 00:00:00 2001 From: hdvanegasm Date: Tue, 29 Oct 2024 17:23:55 -0500 Subject: [PATCH] fix: remove need of setting RUST_LOG environment variable --- src/main.rs | 4 +++- src/net/channel.rs | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 0bceddc..f9f30b2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -30,7 +30,9 @@ struct Args { } fn main() -> Result<(), Box> { - env_logger::init(); + let mut log_builder = env_logger::Builder::new(); + log_builder.filter_level(log::LevelFilter::Info).init(); + let args = Args::parse(); // Create the network for communication. diff --git a/src/net/channel.rs b/src/net/channel.rs index ac03931..0651ec5 100644 --- a/src/net/channel.rs +++ b/src/net/channel.rs @@ -118,7 +118,7 @@ impl Channel for TcpChannel { stream.shutdown(std::net::Shutdown::Both)?; } self.stream = None; - log::info!("channel successfully created"); + log::info!("channel successfully closed"); Ok(()) } @@ -184,6 +184,7 @@ pub struct LoopBackChannel { impl Channel for LoopBackChannel { fn close(&mut self) -> anyhow::Result<()> { self.buffer.clear(); + log::info!("channel successfully closed"); Ok(()) }