mirror of
https://github.com/italicsjenga/valence.git
synced 2024-12-23 14:31: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]
|
||||
anyhow = "1.0.65"
|
||||
clap = { version = "4", features = ["derive"] }
|
||||
glam = "0.23.0"
|
||||
tracing = "0.1.37"
|
||||
tracing-subscriber = "0.3.16"
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
clippy::dbg_macro
|
||||
)]
|
||||
|
||||
use clap::Parser;
|
||||
use tracing::Level;
|
||||
use valence::app::App;
|
||||
|
||||
|
@ -23,9 +24,17 @@ use valence::app::App;
|
|||
mod extras;
|
||||
mod playground;
|
||||
|
||||
#[derive(Parser)]
|
||||
struct Args {
|
||||
#[arg(short, default_value_t = Level::DEBUG)]
|
||||
log_level: Level,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let args = Args::parse();
|
||||
|
||||
tracing_subscriber::fmt()
|
||||
.with_max_level(Level::DEBUG)
|
||||
.with_max_level(args.log_level)
|
||||
.init();
|
||||
|
||||
let mut app = App::new();
|
||||
|
|
Loading…
Reference in a new issue