mirror of
https://github.com/italicsjenga/valence.git
synced 2024-12-23 22:41:30 +11:00
Add cli arg for log level to playground (#343)
## Description Fixes #305 `cargo run -- -l trace` Uses `Level`'s `FromStr` impl, which accepts numbers 1-5 or case-insensitive level names. Default level is `Level::DEBUG`
This commit is contained in:
parent
e3c0aec967
commit
e5de2d3f20
|
@ -5,6 +5,7 @@ edition.workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow = "1.0.65"
|
anyhow = "1.0.65"
|
||||||
|
clap = { version = "4", features = ["derive"] }
|
||||||
glam = "0.23.0"
|
glam = "0.23.0"
|
||||||
tracing = "0.1.37"
|
tracing = "0.1.37"
|
||||||
tracing-subscriber = "0.3.16"
|
tracing-subscriber = "0.3.16"
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
clippy::dbg_macro
|
clippy::dbg_macro
|
||||||
)]
|
)]
|
||||||
|
|
||||||
|
use clap::Parser;
|
||||||
use tracing::Level;
|
use tracing::Level;
|
||||||
use valence::app::App;
|
use valence::app::App;
|
||||||
|
|
||||||
|
@ -23,9 +24,17 @@ use valence::app::App;
|
||||||
mod extras;
|
mod extras;
|
||||||
mod playground;
|
mod playground;
|
||||||
|
|
||||||
|
#[derive(Parser)]
|
||||||
|
struct Args {
|
||||||
|
#[arg(short, default_value_t = Level::DEBUG)]
|
||||||
|
log_level: Level,
|
||||||
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
let args = Args::parse();
|
||||||
|
|
||||||
tracing_subscriber::fmt()
|
tracing_subscriber::fmt()
|
||||||
.with_max_level(Level::DEBUG)
|
.with_max_level(args.log_level)
|
||||||
.init();
|
.init();
|
||||||
|
|
||||||
let mut app = App::new();
|
let mut app = App::new();
|
||||||
|
|
Loading…
Reference in a new issue