From d6f29836c6f93942792219eee8b71468fa8fd2bf Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Sat, 7 May 2022 04:42:47 +0000 Subject: [PATCH] too loud of logging --- web3-proxy/src/connection.rs | 16 +++++++++++++--- web3-proxy/src/connections.rs | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/web3-proxy/src/connection.rs b/web3-proxy/src/connection.rs index 5e34c927..e4b1175c 100644 --- a/web3-proxy/src/connection.rs +++ b/web3-proxy/src/connection.rs @@ -209,7 +209,7 @@ impl Web3Connection { if let Some(connections) = &connections { connections.update_synced_rpcs(&self)?; } else { - info!("new head block from {}: {}", self, block_number); + info!("new head block {} from {}", block_number, self); } while let Some(new_block) = stream.next().await { @@ -295,10 +295,20 @@ impl ActiveRequestHandle { method: &str, params: &serde_json::value::RawValue, ) -> Result, ethers::prelude::ProviderError> { - match &self.0.provider { + // TODO: this should probably be trace level and use a span + // TODO: it would be nice to have the request id on this + info!("Sending {}({}) to {}", method, params.to_string(), self.0); + + let response = match &self.0.provider { Web3Provider::Http(provider) => provider.request(method, params).await, Web3Provider::Ws(provider) => provider.request(method, params).await, - } + }; + + // TODO: i think ethers already has trace logging (and does it much more fancy) + // TODO: at least instrument this with more useful information + info!("Response from {}: {:?}", self.0, response); + + response } } diff --git a/web3-proxy/src/connections.rs b/web3-proxy/src/connections.rs index 40674ff5..0e68f7fe 100644 --- a/web3-proxy/src/connections.rs +++ b/web3-proxy/src/connections.rs @@ -216,7 +216,7 @@ impl Web3Connections { atomic::Ordering::Acquire, ) { Ok(_) => { - info!("new head block from {}: {}", rpc, new_block); + info!("new head block {} from {}", new_block, rpc); } Err(current_best_block_number) => { // actually, there was a race and this ended up not being the latest block. return now without adding this rpc to the synced list