Builds without systemd should no longer hard depend on journald

This commit is contained in:
Foxinatel 2024-08-09 17:58:14 +01:00 committed by Victoria Brekenfeld
parent 7b1588611c
commit 6519f1d068
2 changed files with 6 additions and 4 deletions

View file

@ -39,11 +39,11 @@ zbus_systemd = { version = "0.25600.0", optional = true, features = [
] }
tokio-util = "0.7"
tracing = "0.1"
tracing-journald = "0.3"
tracing-journald = { version = "0.3", optional = true }
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
zbus = { version = "4.3.0", default-features = false, features = ["tokio"] }
cosmic-notifications-util = { git = "https://github.com/pop-os/cosmic-notifications" }
[features]
systemd = ["dep:zbus_systemd"]
systemd = ["dep:zbus_systemd", "dep:tracing-journald"]
default = ["systemd"]

View file

@ -43,8 +43,10 @@ const XDP_COSMIC: Option<&'static str> = option_env!("XDP_COSMIC");
async fn main() -> Result<()> {
color_eyre::install().wrap_err("failed to install color_eyre error handler")?;
tracing_subscriber::registry()
.with(tracing_journald::layer().wrap_err("failed to connect to journald")?)
let trace = tracing_subscriber::registry();
#[cfg(feature = "systemd")]
let trace = trace.with(tracing_journald::layer().wrap_err("failed to connect to journald")?);
trace
.with(fmt::layer())
.with(
EnvFilter::builder()