From b8e6b75ea5cf4ff9608ae1a734bf23dd7c66d38f Mon Sep 17 00:00:00 2001 From: Patrick Date: Mon, 6 Jan 2025 00:02:41 +0100 Subject: [PATCH] fix: follow environment log level --- Cargo.lock | 34 +++++++++++++++++++++++++++++++--- Cargo.toml | 2 +- src/main.rs | 6 +++++- 3 files changed, 37 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9aa0aa9..f709637 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -257,6 +257,15 @@ version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +[[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 = "mdns-relay" version = "0.1.0" @@ -455,8 +464,17 @@ checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", - "regex-automata", - "regex-syntax", + "regex-automata 0.4.9", + "regex-syntax 0.8.5", +] + +[[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]] @@ -467,9 +485,15 @@ checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", - "regex-syntax", + "regex-syntax 0.8.5", ] +[[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.5" @@ -656,10 +680,14 @@ version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" 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 b95350a..60dc027 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,4 +14,4 @@ serde_regex = "1.1.0" simple-dns = "0.9.1" socket2 = { version = "0.5.8", features = ["all"] } tracing = "0.1.41" -tracing-subscriber = "0.3.19" +tracing-subscriber = { version = "0.3.19", features = ["env-filter"] } diff --git a/src/main.rs b/src/main.rs index f4c2bbc..3168b04 100644 --- a/src/main.rs +++ b/src/main.rs @@ -15,6 +15,7 @@ use std::{ net::{Ipv4Addr, SocketAddr, SocketAddrV4}, }; use tracing::{debug, error, trace}; +use tracing_subscriber::EnvFilter; const ADDR: Ipv4Addr = Ipv4Addr::new(224, 0, 0, 251); @@ -73,7 +74,10 @@ struct Config { } fn main() -> Result<()> { - tracing_subscriber::fmt().without_time().init(); + tracing_subscriber::fmt() + .without_time() + .with_env_filter(EnvFilter::from_default_env()) + .init(); let cli = Cli::parse(); let file = File::open(cli.config)?; let reader = BufReader::new(file);