Fix: CLI Logging (#2254)

* fix: cli logging

* remove: debug print
This commit is contained in:
Miles Murgaw 2024-04-05 15:37:40 -04:00 committed by GitHub
parent bd852c68fd
commit f4164c78c2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,6 +1,5 @@
use dioxus_cli_config::DioxusConfig;
use std::{env, path::PathBuf};
use tracing::level_filters::LevelFilter;
use tracing_subscriber::EnvFilter;
use anyhow::Context;
@ -17,19 +16,11 @@ async fn main() -> anyhow::Result<()> {
// If {LOG_ENV} is set, default to env, otherwise filter to cli
// and manganis warnings and errors from other crates
let mut filter = EnvFilter::new("error,dx=info,dioxus-cli=info,manganis-cli-support=info");
if env::var(LOG_ENV).is_ok() {
let filter = EnvFilter::from_env(LOG_ENV);
tracing_subscriber::fmt().with_env_filter(filter).init();
} else {
let filter = EnvFilter::builder()
.with_default_directive(LevelFilter::ERROR.into())
.from_env()
.unwrap()
.add_directive("dioxus_cli=warn".parse().unwrap())
.add_directive("manganis-cli-support=warn".parse().unwrap());
tracing_subscriber::fmt().with_env_filter(filter).init();
filter = EnvFilter::from_env(LOG_ENV);
}
tracing_subscriber::fmt().with_env_filter(filter).init();
match args.action {
Translate(opts) => opts