fix: follow environment log level

This commit is contained in:
Patrick 2025-01-06 00:02:41 +01:00
parent f50ec426de
commit b8e6b75ea5
Signed by: patrick
GPG key ID: 451F95EFB8BECD0F
3 changed files with 37 additions and 5 deletions

34
Cargo.lock generated
View file

@ -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",
]

View file

@ -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"] }

View file

@ -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);