Skip to content

Commit b98cb96

Browse files
authored
Merge pull request #48 from flashbots/peg/fix-logging
The option `--log-debug` should only enable debug logging for this crate
2 parents baf5188 + d8c1305 commit b98cb96

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/main.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,14 @@ async fn main() -> anyhow::Result<()> {
108108
"Exactly one of --measurements-file or --allowed-remote-attestation-type must be provided"
109109
);
110110

111-
let level_filter = if cli.log_debug {
112-
LevelFilter::DEBUG
113-
} else {
114-
LevelFilter::WARN
115-
};
111+
let crate_name = env!("CARGO_PKG_NAME");
116112

117113
let env_filter = tracing_subscriber::EnvFilter::builder()
118-
.with_default_directive(level_filter.into())
119-
.from_env_lossy();
114+
.with_default_directive(LevelFilter::WARN.into()) // global default
115+
.parse_lossy(format!(
116+
"{crate_name}={}",
117+
if cli.log_debug { "debug" } else { "warn" }
118+
));
120119

121120
let subscriber = tracing_subscriber::fmt::Subscriber::builder().with_env_filter(env_filter);
122121

0 commit comments

Comments
 (0)