agentmux_launcher/event_log.rs
1// Copyright 2026, AgentMux Corp.
2// SPDX-License-Identifier: Apache-2.0
3//
4// Launcher-side event log — a thin binding over the shared implementation
5// in `agentmux_common::event_log`.
6//
7// This file used to be the 415-line original (Phase D.2) that srv later
8// mirrored byte-for-byte; the two differed only in which logging sink
9// warnings went to. See `crates/common/src/event_log.rs` for the design
10// and the audit that motivated the lift.
11//
12// Call sites are unchanged: `event_log::EventLog` and
13// `event_log::run_disk_writer(log, rx)` resolve exactly as before. The only
14// launcher-specific decision — warnings go to `crate::log`, the launcher's
15// own rotating file, because the launcher installs no `tracing` subscriber
16// — is bound here, once.
17
18pub use agentmux_common::event_log::EventLog;
19
20/// The launcher's disk writer: the shared writer with the launcher's
21/// warning sink bound.
22pub async fn run_disk_writer(
23 log: std::sync::Arc<EventLog>,
24 events_rx: tokio::sync::broadcast::Receiver<agentmux_common::ipc::Event>,
25) {
26 let warn: agentmux_common::event_log::WarnSink =
27 std::sync::Arc::new(|m: &str| crate::log(m));
28 agentmux_common::event_log::run_disk_writer(log, events_rx, warn).await
29}