improve code for observability

This commit is contained in:
houseme
2025-03-12 00:46:01 +08:00
parent 4b4dbab1ae
commit eaa506add5
14 changed files with 1480 additions and 690 deletions
+13
View File
@@ -0,0 +1,13 @@
use crate::{entry::LogEntry, sink::Sink};
use std::sync::Arc;
use tokio::sync::mpsc::Receiver;
/// Start the log processing worker thread
pub async fn start_worker(receiver: Receiver<LogEntry>, sinks: Vec<Arc<dyn Sink>>) {
let mut receiver = receiver;
while let Some(entry) = receiver.recv().await {
for sink in &sinks {
sink.write(&entry).await;
}
}
}