upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/grasp-audit/src/bin
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2026-02-25 13:50:02 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2026-02-25 13:50:02 +0000
commit680b4f4ec7d9cc5535b348bdc8604cf43d3fc80b (patch)
treefd4c138326dfc1de3355c4f4eadac32dbf24fc51 /grasp-audit/src/bin
parent4fecdd4c60922caa502e1330bad2071cb015ffb9 (diff)
silence all library logs for probe subcommand in both human and JSON modes
Diffstat (limited to 'grasp-audit/src/bin')
-rw-r--r--grasp-audit/src/bin/grasp-audit.rs18
1 files changed, 6 insertions, 12 deletions
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 {
67 67
68#[tokio::main] 68#[tokio::main]
69async fn main() -> Result<()> { 69async fn main() -> Result<()> {
70 // In JSON mode logs must not pollute stdout (used for machine-readable output). 70 // Probe output is self-contained — library chatter (nostr_relay_pool etc.)
71 // Check argv directly so we know the mode before parsing the full CLI. 71 // adds no value and clutters both human and JSON output. Skip the tracing
72 let json_mode = std::env::args().any(|a| a == "--json"); 72 // subscriber entirely for the probe subcommand; initialise it normally for
73 if json_mode { 73 // audit subcommands where verbose output is expected.
74 tracing_subscriber::fmt() 74 let is_probe = std::env::args().nth(1).as_deref() == Some("probe");
75 .with_env_filter( 75 if !is_probe {
76 tracing_subscriber::EnvFilter::from_default_env()
77 .add_directive(tracing::Level::INFO.into()),
78 )
79 .with_writer(std::io::stderr)
80 .init();
81 } else {
82 tracing_subscriber::fmt() 76 tracing_subscriber::fmt()
83 .with_env_filter( 77 .with_env_filter(
84 tracing_subscriber::EnvFilter::from_default_env() 78 tracing_subscriber::EnvFilter::from_default_env()