Skip to content

Commit

Permalink
Revert "Switch logging to env_filter"
Browse files Browse the repository at this point in the history
This reverts commit 79ac6fd.
  • Loading branch information
boxdot committed Nov 22, 2023
1 parent 79ac6fd commit 4b943a7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 24 deletions.
16 changes: 3 additions & 13 deletions Cargo.lock

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

9 changes: 3 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,9 @@ 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 = { path = "../presage/presage" }
presage-store-sled = { path = "../presage/presage-store-sled" }
presage = { git = "https://github.com/whisperfish/presage", rev = "23c157b" }
presage-store-sled = { git = "https://github.com/whisperfish/presage", rev = "23c157b" }

anyhow = "1.0.66"
async-trait = "0.1.58"
Expand Down Expand Up @@ -61,7 +58,7 @@ uuid = { version = "1.2", features = ["v4"] }
whoami = "1.2.3"
tracing = "0.1.37"
tracing-appender = "0.2.2"
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
tracing-subscriber = "0.3.16"
futures-channel = "0.3.25"
qr2term = { git = "https://github.com/boxdot/qr2term-rs", rev = "ed8ae7f" }
clap = { version = "4.0.19", features = ["derive"] }
Expand Down
15 changes: 10 additions & 5 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};
use tracing::{error, info, metadata::LevelFilter};

const TARGET_FPS: u64 = 144;
const RECEIPT_TICK_PERIOD: u64 = 144;
Expand All @@ -35,8 +35,8 @@ const RECEIPT_BUDGET: Duration = Duration::from_millis(RECEIPT_TICK_PERIOD * 100
#[command(author, version, about, long_about = None)]
struct Args {
/// Enables logging to `gurk.log` in the current working directory
#[clap(short, long = "verbose")]
verbose: bool,
#[clap(short, long = "verbose", action = clap::ArgAction::Count)]
verbosity: u8,
/// Relinks the device (helpful when device was unlinked)
#[clap(long)]
relink: bool,
Expand All @@ -46,11 +46,16 @@ struct Args {
async fn main() -> anyhow::Result<()> {
let args = Args::parse();

let _guard = if args.verbose {
let _guard = if args.verbosity > 0 {
let file_appender = tracing_appender::rolling::never("./", "gurk.log");
let (non_blocking, guard) = tracing_appender::non_blocking(file_appender);
tracing_subscriber::fmt()
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
.with_max_level(match args.verbosity {
0 => LevelFilter::OFF,
1 => LevelFilter::INFO,
2 => LevelFilter::DEBUG,
_ => LevelFilter::TRACE,
})
.with_writer(non_blocking)
.with_ansi(false)
.init();
Expand Down

0 comments on commit 4b943a7

Please sign in to comment.