From 710b945b03d6807126dd630ca2920a33649c5afd Mon Sep 17 00:00:00 2001 From: Filip Tibell Date: Sun, 30 Apr 2023 20:48:47 +0200 Subject: [PATCH] Set up logger in cli --- Cargo.lock | 16 +++++++++++++++- packages/cli/Cargo.toml | 1 + packages/cli/src/main.rs | 4 ++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 22e5c42..880ffce 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -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", diff --git a/packages/cli/Cargo.toml b/packages/cli/Cargo.toml index 350150a..586c819 100644 --- a/packages/cli/Cargo.toml +++ b/packages/cli/Cargo.toml @@ -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"] } diff --git a/packages/cli/src/main.rs b/packages/cli/src/main.rs index 842bc4d..c3f43ba 100644 --- a/packages/cli/src/main.rs +++ b/packages/cli/src/main.rs @@ -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) => {