From 0cf474c6f13a2f39e3efc3093659dc0fe1301b08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20F=C3=A9ron?= Date: Tue, 21 Nov 2023 17:42:55 +0100 Subject: [PATCH] Switch logging to env_filter --- Cargo.lock | 16 +++++++++++++--- Cargo.toml | 9 ++++++--- src/main.rs | 9 ++------- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 25007d7..a472ebd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2369,6 +2369,15 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" +[[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 = "md-5" version = "0.10.6" @@ -3100,7 +3109,6 @@ checksum = "94e851c7654eed9e68d7d27164c454961a616cf8c203d500607ef22c737b51bb" [[package]] name = "presage" version = "0.6.0-dev" -source = "git+https://github.com/whisperfish/presage?rev=23c157b#23c157b0ad1e369b3e0318c22b1a45b2a0eefacc" dependencies = [ "base64 0.21.5", "futures", @@ -3119,7 +3127,6 @@ dependencies = [ [[package]] name = "presage-store-cipher" version = "0.1.0" -source = "git+https://github.com/whisperfish/presage?rev=23c157b#23c157b0ad1e369b3e0318c22b1a45b2a0eefacc" dependencies = [ "blake3", "chacha20poly1305", @@ -3136,7 +3143,6 @@ dependencies = [ [[package]] name = "presage-store-sled" version = "0.6.0-dev" -source = "git+https://github.com/whisperfish/presage?rev=23c157b#23c157b0ad1e369b3e0318c22b1a45b2a0eefacc" dependencies = [ "async-trait", "base64 0.12.3", @@ -4585,10 +4591,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 ed35368..ba44fa0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,9 +27,12 @@ debug = true [features] dev = ["prost", "base64"] +#[dependencies] +#presage = { git = "https://github.com/whisperfish/presage", rev = "23c157b" } +#resage-store-sled = { git = "https://github.com/whisperfish/presage", rev = "23c157b" } [dependencies] -presage = { git = "https://github.com/whisperfish/presage", rev = "23c157b" } -presage-store-sled = { git = "https://github.com/whisperfish/presage", rev = "23c157b" } +presage = { path = "../presage/presage" } +presage-store-sled = { path = "../presage/presage-store-sled" } anyhow = "1.0.66" async-trait = "0.1.58" @@ -58,7 +61,7 @@ uuid = { version = "1.2", features = ["v4"] } whoami = "1.2.3" tracing = "0.1.37" tracing-appender = "0.2.2" -tracing-subscriber = "0.3.16" +tracing-subscriber = { version = "0.3.18", features = ["env-filter"] } futures-channel = "0.3.25" qr2term = { git = "https://github.com/boxdot/qr2term-rs", rev = "ed8ae7f" } clap = { version = "4.0.19", features = ["derive"] } diff --git a/src/main.rs b/src/main.rs index aba0afb..585a8f2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -23,7 +23,7 @@ use ratatui::{backend::CrosstermBackend, Terminal}; use tokio::select; use tokio_stream::StreamExt; use tracing::debug; -use tracing::{error, info, metadata::LevelFilter}; +use tracing::{error, info}; const TARGET_FPS: u64 = 144; const RECEIPT_TICK_PERIOD: u64 = 144; @@ -50,12 +50,7 @@ async fn main() -> anyhow::Result<()> { let file_appender = tracing_appender::rolling::never("./", "gurk.log"); let (non_blocking, guard) = tracing_appender::non_blocking(file_appender); tracing_subscriber::fmt() - .with_max_level(match args.verbosity { - 0 => LevelFilter::OFF, - 1 => LevelFilter::INFO, - 2 => LevelFilter::DEBUG, - _ => LevelFilter::TRACE, - }) + .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) .with_writer(non_blocking) .with_ansi(false) .init();