diff --git a/Cargo.toml b/Cargo.toml index b7015dd..c0c7a68 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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"] diff --git a/src/main.rs b/src/main.rs index bf6e2e8..11fe0db 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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()