From e9dff1c0d7751d11a055d1e9b333bb178f83d306 Mon Sep 17 00:00:00 2001 From: Saksham Mittal Date: Mon, 15 May 2023 23:02:15 +0530 Subject: [PATCH] Change log level to debug and warn for certain appropriate situations This commit changes certain log messages to debug for recoverable errors and a warn if all such attempts fail, in order to not clutter up the info messages that end users get to see. --- crates/tor-circmgr/src/mgr.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/crates/tor-circmgr/src/mgr.rs b/crates/tor-circmgr/src/mgr.rs index 7d52fe893..5c2eb3af8 100644 --- a/crates/tor-circmgr/src/mgr.rs +++ b/crates/tor-circmgr/src/mgr.rs @@ -490,7 +490,7 @@ struct CircList { /// open circuits. /// /// A circuit is added here from [`AbstractCircMgr::do_launch`] when we find - /// that it completes successfully, and has not been cancelled. + /// that it completes successfully, and has not been cancelled. /// When we decide that such a circuit should no longer be handed out for /// any new requests, we "retire" the circuit by removing it from this map. #[allow(clippy::type_complexity)] @@ -515,7 +515,7 @@ struct CircList { /// decide that a circuit needs to be launched. /// /// Later, in [`AbstractCircMgr::do_launch`], once the circuit has finished - /// (or failed), we remove the entry (by pointer identity). + /// (or failed), we remove the entry (by pointer identity). /// If we cannot find the entry, we conclude that the request has been /// _cancelled_, and so we discard any circuit that was created. pending_circs: PtrWeakHashSet>>, @@ -862,12 +862,13 @@ impl AbstractCircMgr { match outcome { Ok(Ok(circ)) => return Ok(circ), Ok(Err(e)) => { - info!("Circuit attempt {} failed.", attempt_num); + debug!("Circuit attempt {} failed.", attempt_num); Error::RequestFailed(e) } Err(_) => { // We ran out of "remaining" time; there is nothing // more to be done. + warn!("All circuit attempts failed due to timeout"); retry_err.push(Error::RequestTimeout); break; } @@ -875,7 +876,7 @@ impl AbstractCircMgr { } Err(e) => { // We couldn't pick the action! - info!( + debug!( "Couldn't pick action for circuit attempt {}: {}", attempt_num, e.report(), @@ -903,6 +904,7 @@ impl AbstractCircMgr { *count += 1; // If we have reached our limit of this kind of problem, we're done. if *count >= count_limit { + warn!("Reached circuit build retry limit, exiting..."); break; } @@ -918,6 +920,7 @@ impl AbstractCircMgr { } } + warn!("Request failed"); Err(Error::RequestFailed(retry_err)) } @@ -1177,7 +1180,7 @@ impl AbstractCircMgr { } } - info!( + debug!( "While waiting on circuit: {:?} from {}", id, describe_source(building, src)