From 0ae240492aa61bcee9ce2ad4b2d819829e412b8e Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Tue, 24 Jan 2023 20:44:17 -0800 Subject: [PATCH] easy trace logging --- web3_proxy/src/bin/web3_proxy_cli/main.rs | 24 +++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/web3_proxy/src/bin/web3_proxy_cli/main.rs b/web3_proxy/src/bin/web3_proxy_cli/main.rs index f658b46e..113336b4 100644 --- a/web3_proxy/src/bin/web3_proxy_cli/main.rs +++ b/web3_proxy/src/bin/web3_proxy_cli/main.rs @@ -114,8 +114,28 @@ fn main() -> anyhow::Result<()> { // TODO: is there a better way to do this? let rust_log = match std::env::var("RUST_LOG") { Ok(x) => x, - Err(_) => "info,ethers=debug,redis_rate_limit=debug,web3_proxy=debug,web3_proxy_cli=debug" - .to_string(), + Err(_) => match std::env::var("WEB3_PROXY_TRACE").map(|x| x == "true") { + Ok(true) => { + vec![ + "info", + "ethers=debug", + "redis_rate_limit=debug", + "web3_proxy=trace", + "web3_proxy_cli=trace", + "web3_proxy::rpcs::blockchain=info", + ] + } + _ => { + vec![ + "info", + "ethers=debug", + "redis_rate_limit=debug", + "web3_proxy=debug", + "web3_proxy_cli=debug", + ] + } + } + .join(","), }; // this probably won't matter for us in docker, but better safe than sorry