diff options
author | Florian Klink <flokli@flokli.de> | 2024-04-26T14·19+0300 |
---|---|---|
committer | flokli <flokli@flokli.de> | 2024-04-26T15·10+0000 |
commit | 9401cccf841de29e17eb0453aa77439f61f3e650 (patch) | |
tree | 0714b8554ca846563f0069f60f32e9c8efd82d67 | |
parent | 88922bb2078c33ba6b352e15b4b3410a0cbc8baf (diff) |
feat(tvix/cli): change log format to compact, add RUST_LOG support r/8019
This brings feature parity with the tvix-store CLI command, at least as far as logging (not tracing) is concerned. Alternative to cl/11482, RUST_LOG seems to be the more canonical way to influence this, and is consistent with how it's done in tvix-store. Change-Id: I923a0b0ae55dc49af7efdacdcf5b1f24e561b3c2 Reviewed-on: https://cl.tvl.fyi/c/depot/+/11527 Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI Reviewed-by: picnoir picnoir <picnoir@alternativebit.fr>
-rw-r--r-- | tvix/cli/src/main.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tvix/cli/src/main.rs b/tvix/cli/src/main.rs index 436e895863ee..5635f446b993 100644 --- a/tvix/cli/src/main.rs +++ b/tvix/cli/src/main.rs @@ -5,6 +5,7 @@ use std::{fs, path::PathBuf}; use tracing::Level; use tracing_subscriber::fmt::writer::MakeWriterExt; use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt}; +use tracing_subscriber::{EnvFilter, Layer}; use tvix_build::buildservice; use tvix_eval::builtins::impure_builtins; use tvix_eval::observer::{DisassemblingObserver, TracingObserver}; @@ -229,7 +230,13 @@ fn main() { let subscriber = tracing_subscriber::registry().with( tracing_subscriber::fmt::Layer::new() .with_writer(std::io::stderr.with_max_level(level)) - .pretty(), + .compact() + .with_filter( + EnvFilter::builder() + .with_default_directive(level.into()) + .from_env() + .expect("invalid RUST_LOG"), + ), ); subscriber .try_init() |