From 680b4f4ec7d9cc5535b348bdc8604cf43d3fc80b Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Wed, 25 Feb 2026 13:50:02 +0000 Subject: silence all library logs for probe subcommand in both human and JSON modes --- grasp-audit/src/bin/grasp-audit.rs | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'grasp-audit/src/bin') diff --git a/grasp-audit/src/bin/grasp-audit.rs b/grasp-audit/src/bin/grasp-audit.rs index a6db627..3d5b107 100644 --- a/grasp-audit/src/bin/grasp-audit.rs +++ b/grasp-audit/src/bin/grasp-audit.rs @@ -67,18 +67,12 @@ enum Commands { #[tokio::main] async fn main() -> Result<()> { - // In JSON mode logs must not pollute stdout (used for machine-readable output). - // Check argv directly so we know the mode before parsing the full CLI. - let json_mode = std::env::args().any(|a| a == "--json"); - if json_mode { - tracing_subscriber::fmt() - .with_env_filter( - tracing_subscriber::EnvFilter::from_default_env() - .add_directive(tracing::Level::INFO.into()), - ) - .with_writer(std::io::stderr) - .init(); - } else { + // Probe output is self-contained — library chatter (nostr_relay_pool etc.) + // adds no value and clutters both human and JSON output. Skip the tracing + // subscriber entirely for the probe subcommand; initialise it normally for + // audit subcommands where verbose output is expected. + let is_probe = std::env::args().nth(1).as_deref() == Some("probe"); + if !is_probe { tracing_subscriber::fmt() .with_env_filter( tracing_subscriber::EnvFilter::from_default_env() -- cgit v1.2.3