fix: make setup_logging() resilient to journal logger failure (v0.5.1)

Replace unwrap() calls with match-based error handling that falls back
to eprintln — prevents panic when running outside a systemd session.
Consistent with moonlock's logging init pattern.
This commit is contained in:
nevaforget 2026-03-28 22:56:39 +01:00
parent 7c10516473
commit d5e431d37e
2 changed files with 11 additions and 5 deletions

View File

@ -1,6 +1,6 @@
[package]
name = "moongreet"
version = "0.5.0"
version = "0.5.1"
edition = "2024"
description = "A greetd greeter for Wayland with GTK4 and Layer Shell"
license = "MIT"

View File

@ -92,10 +92,16 @@ fn activate(app: &gtk::Application) {
}
fn setup_logging() {
systemd_journal_logger::JournalLog::new()
.unwrap()
.install()
.unwrap();
match systemd_journal_logger::JournalLog::new() {
Ok(logger) => {
if let Err(e) = logger.install() {
eprintln!("Failed to install journal logger: {e}");
}
}
Err(e) => {
eprintln!("Failed to create journal logger: {e}");
}
}
let level = if std::env::var("MOONGREET_DEBUG").is_ok() {
log::LevelFilter::Debug
} else {