Event logs

This commit is contained in:
2026-07-15 08:48:19 -04:00
parent a37d21afd1
commit ea156338a3
3 changed files with 46 additions and 4 deletions
+22 -1
View File
@@ -1,9 +1,30 @@
use crate::types::{Account, ActivePosition, Signal, SignalKind, System, WatchListItem};
use crate::types::{
Account, ActivePosition, EventLog, LogKind, Signal, SignalKind, System, WatchListItem,
};
pub trait Formatted {
fn get_formatted(&self) -> Vec<String>;
}
impl Formatted for EventLog {
fn get_formatted(&self) -> Vec<String> {
vec![
format!(
"{}{:?}\x1b[0m",
match &self.kind {
LogKind::INFO => "\x1b[34m",
LogKind::DEBUG => "\x1b[36m",
LogKind::ERR => "\x1b[31m",
LogKind::WARN => "\x1b[33m",
},
self.kind
),
format!("(\x1b[37m{}\x1b[0m)", self.name),
self.message.clone(),
]
}
}
impl Formatted for Signal {
fn get_formatted(&self) -> Vec<String> {
vec![