Remove warnings from unused colors.

This commit is contained in:
Michael Mikovsky
2026-03-04 12:22:23 -07:00
parent 07e3f83bcf
commit 2c3962fa99
2 changed files with 17 additions and 16 deletions
+13 -12
View File
@@ -4,17 +4,6 @@ pub struct PrettyLogger {
output: Option<Box<dyn Fn(&Record)>>,
}
// static TRACE_COLOR: &str = "\x1b[34m";
static DEBUG_COLOR: &str = "\x1b[36m";
static INFO_COLOR: &str = "\x1b[32m";
static WARN_COLOR: &str = "\x1b[33m";
static ERROR_COLOR: &str = "\x1b[31m";
static WHITE: &str = "\x1b[97m";
static OFF_WHITE: &str = "\x1b[37m";
static TIME_COLOR: &str = "\x1b[36m";
static GREY: &str = "\x1b[90m";
impl Logger for PrettyLogger {
fn log(&self, message: Record) {
if let Some(ref func) = self.output {
@@ -26,6 +15,11 @@ impl Logger for PrettyLogger {
}
pub fn log(message: &Record) {
static DEBUG_COLOR: &str = "\x1b[36m";
static INFO_COLOR: &str = "\x1b[32m";
static WARN_COLOR: &str = "\x1b[33m";
static ERROR_COLOR: &str = "\x1b[31m";
let log_level = match message.log_level {
LogLevel::Debug => format!("{DEBUG_COLOR}DBUG"),
LogLevel::Info => format!("{INFO_COLOR}INFO"),
@@ -35,6 +29,8 @@ pub fn log(message: &Record) {
match (message.time, &message.location) {
(None, None) => {
static WHITE: &str = "\x1b[97m";
println!("{} {WHITE}{}", log_level, message.message,);
}
@@ -44,13 +40,18 @@ pub fn log(message: &Record) {
let date: DateTime<Utc> = time.into();
static WHITE: &str = "\x1b[97m";
static OFF_WHITE: &str = "\x1b[37m";
static TIME_COLOR: &str = "\x1b[36m";
static GREY: &str = "\x1b[90m";
println!(
"{OFF_WHITE}[{TIME_COLOR}{}{OFF_WHITE}] {} {WHITE}{} {GREY}{}{WHITE}",
date, log_level, message.message, location
);
}
_ => unreachable!("All debug fields must be present or removed."),
_ => unreachable!("Invalid log configuration"),
}
}