diff --git a/Cargo.lock b/Cargo.lock index e83cc63..7a8a819 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -29,6 +29,15 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + [[package]] name = "allocator-api2" version = "0.2.18" @@ -932,6 +941,15 @@ dependencies = [ "hashbrown", ] +[[package]] +name = "matchers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata 0.1.10", +] + [[package]] name = "memchr" version = "2.7.4" @@ -1347,6 +1365,50 @@ dependencies = [ "thiserror", ] +[[package]] +name = "regex" +version = "1.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata 0.4.7", + "regex-syntax 0.8.4", +] + +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax 0.6.29", +] + +[[package]] +name = "regex-automata" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax 0.8.4", +] + +[[package]] +name = "regex-syntax" +version = "0.6.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" + +[[package]] +name = "regex-syntax" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" + [[package]] name = "reqwest" version = "0.12.7" @@ -2111,10 +2173,14 @@ version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" dependencies = [ + "matchers", "nu-ansi-term", + "once_cell", + "regex", "sharded-slab", "smallvec", "thread_local", + "tracing", "tracing-core", "tracing-log", ] diff --git a/Cargo.toml b/Cargo.toml index 9bdc2bd..411645d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,6 @@ gitnow = { path = "crates/gitnow" } anyhow = { version = "1" } tokio = { version = "1", features = ["full"] } tracing = { version = "0.1", features = ["log"] } -tracing-subscriber = { version = "0.3.18" } +tracing-subscriber = { version = "0.3.18", features = ["env-filter"] } clap = { version = "4", features = ["derive", "env"] } dotenv = { version = "0.15" } diff --git a/crates/gitnow/src/main.rs b/crates/gitnow/src/main.rs index 89ff0da..e703b0e 100644 --- a/crates/gitnow/src/main.rs +++ b/crates/gitnow/src/main.rs @@ -6,6 +6,8 @@ use anyhow::Context; use clap::{Parser, Subcommand}; use commands::root::RootCommand; use config::Config; +use tracing::level_filters::LevelFilter; +use tracing_subscriber::EnvFilter; mod app; mod cache; @@ -51,7 +53,13 @@ const DEFAULT_CONFIG_PATH: &str = ".config/gitnow/gitnow.toml"; #[tokio::main] async fn main() -> anyhow::Result<()> { dotenv::dotenv().ok(); - tracing_subscriber::fmt::init(); + tracing_subscriber::fmt() + .with_env_filter( + EnvFilter::builder() + .with_default_directive(LevelFilter::WARN.into()) + .from_env_lossy(), + ) + .init(); let home = std::env::var("HOME").context("HOME was not found, are you using a proper shell?")?;