Skip to content

Commit

Permalink
Switch logging to env_filter
Browse files Browse the repository at this point in the history
  • Loading branch information
gferon committed Nov 21, 2023
1 parent 7e9d788 commit 0cf474c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
16 changes: 13 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"] }
Expand Down
9 changes: 2 additions & 7 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
Expand Down

0 comments on commit 0cf474c

Please sign in to comment.