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:
parent
7c10516473
commit
d5e431d37e
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "moongreet"
|
name = "moongreet"
|
||||||
version = "0.5.0"
|
version = "0.5.1"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
description = "A greetd greeter for Wayland with GTK4 and Layer Shell"
|
description = "A greetd greeter for Wayland with GTK4 and Layer Shell"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|||||||
14
src/main.rs
14
src/main.rs
@ -92,10 +92,16 @@ fn activate(app: >k::Application) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn setup_logging() {
|
fn setup_logging() {
|
||||||
systemd_journal_logger::JournalLog::new()
|
match systemd_journal_logger::JournalLog::new() {
|
||||||
.unwrap()
|
Ok(logger) => {
|
||||||
.install()
|
if let Err(e) = logger.install() {
|
||||||
.unwrap();
|
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() {
|
let level = if std::env::var("MOONGREET_DEBUG").is_ok() {
|
||||||
log::LevelFilter::Debug
|
log::LevelFilter::Debug
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user