Start reworking the manager system

This commit is contained in:
Michael Mikovsky
2026-02-04 22:19:16 -07:00
parent 82d8e1ba10
commit fc625e89d2
7 changed files with 82 additions and 867 deletions
+1
View File
@@ -3,6 +3,7 @@
pub mod config;
mod error;
pub mod logger;
pub mod manager;
mod announcement;
+36
View File
@@ -0,0 +1,36 @@
/// Implement logging for the manager
use crossbeam_channel::Sender;
use crate::{
logger::{Logger, Record},
manager::Manager,
};
pub struct ManagerLogger {
tx: Sender<Record>,
}
impl ManagerLogger {
pub fn new(tx: Sender<Record>) -> Self {
Self { tx }
}
}
// impl Manager {
// /// Initiate the unshell logger, piped through the manager
// /// This will allow access to the logs through the tree
// pub fn init_logger(&self) {
// // Create the logger through the TX element of the manager
// let logger = ManagerLogger::new(self.logs_tx.clone());
// // Set the logger through unshell
// crate::logger::set_logger_box(Box::new(logger));
// }
// }
impl Logger for ManagerLogger {
fn log(&self, log: crate::logger::Record) {
// This will never panic if the program is operating properly
self.tx.send(log).unwrap();
}
}
+23
View File
@@ -0,0 +1,23 @@
mod log;
pub struct Manager {
// logs_tx: Sender<Record>,
// logs_rx: Receiver<Record>,
}
impl Manager {
pub fn new() -> Self {
Self {}
// let (tx, rx) = crossbeam_channel::unbounded();
// Self {
// logs_tx: tx,
// logs_rx: rx,
// }
}
// pub fn log_count(&self) -> usize {
// self.logs_rx.len()
// }
}