Skip to content

Commit

Permalink
Builds without systemd should no longer hard depend on journald
Browse files Browse the repository at this point in the history
  • Loading branch information
Foxinatel authored and Drakulix committed Aug 29, 2024
1 parent 7b15886 commit 6519f1d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
6 changes: 4 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 6519f1d

Please sign in to comment.