fix: log cosmic-settings-daemon output

This commit is contained in:
Ashley Wulber 2024-10-16 20:33:10 -04:00
parent b3900bc33e
commit c3a35f323b
No known key found for this signature in database
GPG key ID: 5216D4F46A90A820

View file

@ -78,9 +78,10 @@ async fn main() -> Result<()> {
let session_tx_clone = session_tx.clone();
let _conn = ConnectionBuilder::session()?
.name("com.system76.CosmicSession")?
.serve_at("/com/system76/CosmicSession", service::SessionService {
session_tx,
})?
.serve_at(
"/com/system76/CosmicSession",
service::SessionService { session_tx },
)?
.build()
.await?;
@ -149,8 +150,27 @@ async fn start(
env_vars.push(("XDG_SESSION_TYPE".to_string(), "wayland".to_string()));
systemd::set_systemd_environment("XDG_SESSION_TYPE", "wayland").await;
let stdout_span = info_span!(parent: None, "cosmic-settings-daemon");
let stderr_span = stdout_span.clone();
process_manager
.start(Process::new().with_executable("cosmic-settings-daemon"))
.start(
Process::new()
.with_executable("cosmic-settings-daemon")
.with_on_stdout(move |_, _, line| {
let stdout_span = stdout_span.clone();
async move {
info!("{}", line);
}
.instrument(stdout_span)
})
.with_on_stderr(move |_, _, line| {
let stderr_span = stderr_span.clone();
async move {
warn!("{}", line);
}
.instrument(stderr_span)
}),
)
.await
.expect("failed to start settings daemon");