mirror of
https://github.com/Astatin3/unshell.git
synced 2026-06-08 22:38:01 -06:00
Remove warnings from unused colors.
This commit is contained in:
+13
-12
@@ -4,17 +4,6 @@ pub struct PrettyLogger {
|
|||||||
output: Option<Box<dyn Fn(&Record)>>,
|
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 {
|
impl Logger for PrettyLogger {
|
||||||
fn log(&self, message: Record) {
|
fn log(&self, message: Record) {
|
||||||
if let Some(ref func) = self.output {
|
if let Some(ref func) = self.output {
|
||||||
@@ -26,6 +15,11 @@ impl Logger for PrettyLogger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn log(message: &Record) {
|
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 {
|
let log_level = match message.log_level {
|
||||||
LogLevel::Debug => format!("{DEBUG_COLOR}DBUG"),
|
LogLevel::Debug => format!("{DEBUG_COLOR}DBUG"),
|
||||||
LogLevel::Info => format!("{INFO_COLOR}INFO"),
|
LogLevel::Info => format!("{INFO_COLOR}INFO"),
|
||||||
@@ -35,6 +29,8 @@ pub fn log(message: &Record) {
|
|||||||
|
|
||||||
match (message.time, &message.location) {
|
match (message.time, &message.location) {
|
||||||
(None, None) => {
|
(None, None) => {
|
||||||
|
static WHITE: &str = "\x1b[97m";
|
||||||
|
|
||||||
println!("{} {WHITE}{}", log_level, message.message,);
|
println!("{} {WHITE}{}", log_level, message.message,);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,13 +40,18 @@ pub fn log(message: &Record) {
|
|||||||
|
|
||||||
let date: DateTime<Utc> = time.into();
|
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!(
|
println!(
|
||||||
"{OFF_WHITE}[{TIME_COLOR}{}{OFF_WHITE}] {} {WHITE}{} {GREY}{}{WHITE}",
|
"{OFF_WHITE}[{TIME_COLOR}{}{OFF_WHITE}] {} {WHITE}{} {GREY}{}{WHITE}",
|
||||||
date, log_level, message.message, location
|
date, log_level, message.message, location
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_ => unreachable!("All debug fields must be present or removed."),
|
_ => unreachable!("Invalid log configuration"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
#![macro_use]
|
#![macro_use]
|
||||||
extern crate unshell;
|
extern crate unshell;
|
||||||
|
|
||||||
use unshell::{info, logger::PrettyLogger, obfuscate::sym};
|
use unshell::{info, obfuscate::sym, tree::Tree};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
PrettyLogger::init();
|
// PrettyLogger::init();
|
||||||
|
|
||||||
// let mut manager = Tree::new();
|
let mut manager = Tree::new();
|
||||||
// manager.init_logger();
|
manager.init_logger();
|
||||||
|
|
||||||
println!("{}", sym!("TEST"));
|
println!("{}", sym!("TEST"));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user