Set up logger in cli

This commit is contained in:
Filip Tibell 2023-04-30 20:48:47 +02:00
parent a6ed00ad33
commit 710b945b03
No known key found for this signature in database
3 changed files with 20 additions and 1 deletions

16
Cargo.lock generated
View file

@ -537,6 +537,19 @@ dependencies = [
"termcolor",
]
[[package]]
name = "env_logger"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0"
dependencies = [
"humantime",
"is-terminal",
"log",
"regex",
"termcolor",
]
[[package]]
name = "erased-serde"
version = "0.3.25"
@ -1096,6 +1109,7 @@ dependencies = [
"anyhow",
"clap 4.2.5",
"console",
"env_logger 0.10.0",
"full_moon",
"futures-util",
"include_dir",
@ -1444,7 +1458,7 @@ dependencies = [
"clap 2.34.0",
"cookie",
"dirs",
"env_logger",
"env_logger 0.9.3",
"log",
"plist",
"winapi",

View file

@ -31,6 +31,7 @@ serde_yaml.workspace = true
tokio.workspace = true
anyhow = "1.0"
env_logger = "0.10"
clap = { version = "4.1", features = ["derive"] }
full_moon = { version = "0.17", features = ["roblox"] }

View file

@ -24,6 +24,10 @@ use console::style;
#[tokio::main(flavor = "multi_thread")]
async fn main() -> ExitCode {
let logger_env = env_logger::Env::default().default_filter_or("error");
env_logger::Builder::from_env(logger_env)
.format_timestamp(None)
.init();
match Cli::parse().run().await {
Ok(code) => code,
Err(err) => {