agentmux_srv/event_log.rs
1// Copyright 2026, AgentMux Corp.
2// SPDX-License-Identifier: Apache-2.0
3//
4// srv-side event log — a thin binding over the shared implementation in
5// `agentmux_common::event_log`.
6//
7// This file used to be a 415-line byte-for-byte mirror of the launcher's
8// event log, differing only in which logging sink warnings went to. Its own
9// header carried the to-do ("Phase E.7 cleanup: lift the shared parts into
10// agentmux-common and unify launcher + srv event logs. (reagent P2 #610.)");
11// this is that lift. See `crates/common/src/event_log.rs` for the design.
12//
13// Call sites are unchanged: `event_log::EventLog` and
14// `event_log::run_disk_writer(log, rx)` resolve exactly as before. The only
15// srv-specific decision — warnings go to `tracing::warn!` under the
16// `event-log` target — is bound here, once.
17
18pub use agentmux_common::event_log::EventLog;
19
20/// srv's disk writer: the shared writer with srv's warning sink bound.
21pub async fn run_disk_writer(
22 log: std::sync::Arc<EventLog>,
23 events_rx: tokio::sync::broadcast::Receiver<agentmux_common::ipc::Event>,
24) {
25 let warn: agentmux_common::event_log::WarnSink =
26 std::sync::Arc::new(|m: &str| tracing::warn!(target: "event-log", "{}", m));
27 agentmux_common::event_log::run_disk_writer(log, events_rx, warn).await
28}