feat(tvix/cli): change log format to compact, add RUST_LOG support
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>
This commit is contained in:
parent
88922bb207
commit
9401cccf84
1 changed files with 8 additions and 1 deletions
|
@ -5,6 +5,7 @@ use std::{fs, path::PathBuf};
|
||||||
use tracing::Level;
|
use tracing::Level;
|
||||||
use tracing_subscriber::fmt::writer::MakeWriterExt;
|
use tracing_subscriber::fmt::writer::MakeWriterExt;
|
||||||
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
|
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
|
||||||
|
use tracing_subscriber::{EnvFilter, Layer};
|
||||||
use tvix_build::buildservice;
|
use tvix_build::buildservice;
|
||||||
use tvix_eval::builtins::impure_builtins;
|
use tvix_eval::builtins::impure_builtins;
|
||||||
use tvix_eval::observer::{DisassemblingObserver, TracingObserver};
|
use tvix_eval::observer::{DisassemblingObserver, TracingObserver};
|
||||||
|
@ -229,7 +230,13 @@ fn main() {
|
||||||
let subscriber = tracing_subscriber::registry().with(
|
let subscriber = tracing_subscriber::registry().with(
|
||||||
tracing_subscriber::fmt::Layer::new()
|
tracing_subscriber::fmt::Layer::new()
|
||||||
.with_writer(std::io::stderr.with_max_level(level))
|
.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
|
subscriber
|
||||||
.try_init()
|
.try_init()
|
||||||
|
|
Loading…
Reference in a new issue