From 13ae092b918e9e31b59fdd39af559d08e60cf492 Mon Sep 17 00:00:00 2001 From: Anthony Oteri Date: Fri, 29 Sep 2023 15:05:23 -0400 Subject: [PATCH] Replace femme logger with simple_logger --- Cargo.toml | 2 +- src/error.rs | 3 +++ src/main.rs | 8 +++++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 09bf1d1..580a857 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,7 +23,7 @@ categories = [ [dependencies] async-std = { version = "1.12.0", features = ["async-attributes", "attributes", "tokio1"] } clap = { version = "4.4.3", features = ["derive", "env", "wrap_help"] } -femme = "2.2.1" +simple_logger = { version = "4.2.0", features = ["timestamps", "colors", "stderr"] } http = "0.2.9" indoc = "2.0.4" log = "0.4.20" diff --git a/src/error.rs b/src/error.rs index 7b51be1..dea2f06 100644 --- a/src/error.rs +++ b/src/error.rs @@ -32,6 +32,9 @@ pub enum DredgeError { #[error(transparent)] IOError(#[from] std::io::Error), + + #[error(transparent)] + LoggerError(#[from] log::SetLoggerError), } /// An error related to the communication with the registry API. diff --git a/src/main.rs b/src/main.rs index 09704e4..8b88f2e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -19,6 +19,7 @@ use std::io::{self, Write}; use clap::Parser; +use simple_logger::SimpleLogger; use url::Url; use crate::cli::Cli; @@ -62,7 +63,12 @@ async fn main() -> Result<(), DredgeError> { // -- Initialize logging let log_level = args.log_level; - femme::with_level(log::LevelFilter::from(log_level)); + SimpleLogger::new() + .with_colors(true) + .with_utc_timestamps() + .with_level(log_level.into()) + .env() + .init()?; // -- Parse the given argument into a complete URL let registry_url: Url = parse_registry_arg(&args.registry)?;