commented out debug print statements and removed some commented out code that's no longer needed
This commit is contained in:
@@ -2,107 +2,38 @@
|
||||
#![allow(unused)]
|
||||
use std::{fmt, sync::mpsc::Sender};
|
||||
|
||||
// pub struct Logger {}
|
||||
// pub struct Entry {
|
||||
// etype: EntryType,
|
||||
// pub message: String,
|
||||
// }
|
||||
|
||||
// impl Logger {
|
||||
// pub const fn new() -> Self {
|
||||
// Self {}
|
||||
// }
|
||||
// #[derive(Copy, Clone, Eq, PartialEq)]
|
||||
// enum EntryType {
|
||||
// Debug,
|
||||
// Info,
|
||||
// Warn,
|
||||
// Error,
|
||||
// Fatal,
|
||||
// }
|
||||
|
||||
// pub fn log(&self, message: &str) {
|
||||
// _ = self;
|
||||
// println!("\x1b[32mINFO:\x1b[0m {message}");
|
||||
// impl fmt::Display for EntryType {
|
||||
// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
// write!(
|
||||
// f,
|
||||
// "{:<5}",
|
||||
// match self {
|
||||
// Self::Debug => "DEBUG",
|
||||
// Self::Info => "INFO",
|
||||
// Self::Warn => "WARN",
|
||||
// Self::Error => "ERROR",
|
||||
// Self::Fatal => "FATAL",
|
||||
// }
|
||||
// )
|
||||
// }
|
||||
// }
|
||||
|
||||
// #[derive(Debug)]=
|
||||
// pub struct Logger {
|
||||
// pub sender: Sender<Entry>,
|
||||
// }
|
||||
|
||||
// impl Logger {
|
||||
// pub fn new(sender: Sender<Entry>) -> Self {
|
||||
// Self { sender }
|
||||
// }
|
||||
|
||||
// pub fn debug<T: fmt::Display>(&self, message: T) {
|
||||
// self.sender
|
||||
// .send(Entry {
|
||||
// etype: EntryType::Debug,
|
||||
// message: message.to_string(),
|
||||
// })
|
||||
// .unwrap();
|
||||
// }
|
||||
|
||||
// pub fn info<T: fmt::Display>(&self, message: T) {
|
||||
// self.sender
|
||||
// .send(Entry {
|
||||
// etype: EntryType::Info,
|
||||
// message: message.to_string(),
|
||||
// })
|
||||
// .unwrap();
|
||||
// }
|
||||
|
||||
// pub fn warn<T: fmt::Display>(&self, message: T) {
|
||||
// self.sender
|
||||
// .send(Entry {
|
||||
// etype: EntryType::Warn,
|
||||
// message: message.to_string(),
|
||||
// })
|
||||
// .unwrap();
|
||||
// }
|
||||
|
||||
// pub fn error<T: fmt::Display>(&self, message: T) {
|
||||
// self.sender
|
||||
// .send(Entry {
|
||||
// etype: EntryType::Error,
|
||||
// message: message.to_string(),
|
||||
// })
|
||||
// .unwrap();
|
||||
// }
|
||||
|
||||
// pub fn fatal<T: fmt::Display>(&self, message: T) {
|
||||
// self.sender
|
||||
// .send(Entry {
|
||||
// etype: EntryType::Fatal,
|
||||
// message: message.to_string(),
|
||||
// })
|
||||
// .unwrap();
|
||||
// impl fmt::Display for Entry {
|
||||
// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
// write!(f, "{}: {}", self.etype, self.message)
|
||||
// }
|
||||
// }
|
||||
|
||||
pub struct Entry {
|
||||
etype: EntryType,
|
||||
pub message: String,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Eq, PartialEq)]
|
||||
enum EntryType {
|
||||
Debug,
|
||||
Info,
|
||||
Warn,
|
||||
Error,
|
||||
Fatal,
|
||||
}
|
||||
|
||||
impl fmt::Display for EntryType {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"{:<5}",
|
||||
match self {
|
||||
Self::Debug => "DEBUG",
|
||||
Self::Info => "INFO",
|
||||
Self::Warn => "WARN",
|
||||
Self::Error => "ERROR",
|
||||
Self::Fatal => "FATAL",
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for Entry {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "{}: {}", self.etype, self.message)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user