diff --git a/Cargo.lock b/Cargo.lock
index 8216f9c..9fe511d 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -221,13 +221,12 @@ dependencies = [
name = "dcr"
version = "0.9.1"
dependencies = [
- "anstyle",
"ctrlc",
"env_logger",
"fatfs",
"glob",
"log",
- "paris-log",
+ "owo-colors",
"self-replace",
"serde",
"serde_json",
@@ -748,20 +747,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e"
[[package]]
-name = "paris"
-version = "1.5.15"
+name = "owo-colors"
+version = "4.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8fecab3723493c7851f292cb060f3ee1c42f19b8d749345d0d7eaf3fd19aa62d"
-
-[[package]]
-name = "paris-log"
-version = "1.0.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "774dbe6c00feee96462fae6b32789d9f570569f0b1543cea61336932b240d7eb"
-dependencies = [
- "log",
- "paris",
-]
+checksum = "13c45bb4a6ae1280ec0803b1ef9d3455eb50f01efbbe1447ab020f1d54fba9d8"
[[package]]
name = "percent-encoding"
diff --git a/Cargo.toml b/Cargo.toml
index 59c0c87..920c370 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -78,8 +78,7 @@ fatfs = { version = "0.3", optional = true }
#Logging
log = "0.4.34"
env_logger = "0.11.11"
-anstyle = "1.0.14"
-paris-log = "1" # Под влияние попадают все строки переданные в логирование, надо осторожно
+owo-colors = "4"
[profile.release]
opt-level = "z"
diff --git a/src/cli/add.rs b/src/cli/add.rs
index 4fb1f7f..e2b0a40 100644
--- a/src/cli/add.rs
+++ b/src/cli/add.rs
@@ -112,7 +112,7 @@ pub fn add(args: &[String]) -> i32 {
let mut config = match Config::open(&root.join("dcr.toml").to_string_lossy()) {
Ok(cfg) => cfg,
Err(err) => {
- error!("{}", &err.to_string());
+ error!("{err}");
return 1;
}
};
diff --git a/src/cli/build.rs b/src/cli/build.rs
index 9e73aea..6116127 100644
--- a/src/cli/build.rs
+++ b/src/cli/build.rs
@@ -243,7 +243,7 @@ pub fn build(args: &[String]) -> i32 {
}
Err(err) => {
common::finish_progress_line();
- error!("{}", &err.message);
+ error!("{}", err.message);
1
}
}
diff --git a/src/main.rs b/src/main.rs
index 80faadd..d3dc23e 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -14,7 +14,6 @@
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-use crate::utils::log;
mod cli;
mod config;
mod core;
@@ -30,7 +29,7 @@ use prelude::*;
/// appropriate subcommand handler. With fewer than two arguments, shows help and
/// exits with code 0; otherwise exits with the handler's exit code.
fn main() {
- log::init();
+ utils::log::init();
let args: Vec = std::env::args().collect();
diff --git a/src/prelude.rs b/src/prelude.rs
index 99d8c36..a56e30e 100644
--- a/src/prelude.rs
+++ b/src/prelude.rs
@@ -1 +1,2 @@
-pub use paris_log::{error, warn};
+pub use log::{error, warn};
+// use owo_colors::OwoColorize;
diff --git a/src/utils/log.rs b/src/utils/log.rs
index f38e445..1fe5a7a 100644
--- a/src/utils/log.rs
+++ b/src/utils/log.rs
@@ -15,34 +15,30 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-use anstyle::{AnsiColor, Style};
use env_logger::*;
use log::*;
+use owo_colors::OwoColorize;
use std::io::Write;
// Функция инициализирующая логирование
pub fn init() {
Builder::new()
.filter_level(LevelFilter::Warn)
+ .write_style(WriteStyle::Auto)
.format(|buf, record| {
- let color = match record.level() {
- Level::Error => AnsiColor::Red,
- Level::Warn => AnsiColor::Yellow,
- Level::Info => AnsiColor::White,
- Level::Debug => AnsiColor::Magenta,
- Level::Trace => AnsiColor::BrightBlack,
+ let colored_lv = match record.level() {
+ Level::Error => record.level().red().to_string(),
+ Level::Warn => record.level().yellow().to_string(),
+ Level::Info => record.level().default_color().to_string(),
+ _ => record.level().purple().italic().to_string(),
};
- let style = Style::new().fg_color(Some(color.into())).bold();
-
writeln!(
buf,
- "{style}{}{style:#}: {}",
- record.level().to_string().to_lowercase(),
+ "{}: {}",
+ colored_lv.to_lowercase().bold(),
record.args(),
)
})
.init();
-
- // env_logger::init(); // Уровень логирования из переменных окружения
}