event_monitor: make it possible to subscribe to Monitor

Signed-off-by: Omer Faruk Bayram <omer.faruk@sartura.hr>
This commit is contained in:
Omer Faruk Bayram
2023-08-13 15:13:59 +00:00
committed by Bo Chen
parent 654ac49bd6
commit e02efe9ba0
2 changed files with 25 additions and 1 deletions

View File

@@ -319,8 +319,14 @@ pub fn start_event_monitor_thread(
std::panic::catch_unwind(AssertUnwindSafe(move || {
while let Ok(event) = monitor.rx.recv() {
let event = Arc::new(event);
monitor.file.write_all(event.as_bytes().as_ref()).ok();
monitor.file.write_all(b"\n\n").ok();
for tx in monitor.broadcast.iter() {
tx.send(event.clone()).ok();
}
}
}))
.map_err(|_| {