diff --git a/Cargo.toml b/Cargo.toml index 3def9c8..91204c4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,7 +18,5 @@ actix-files = "0.6" tokio = { version = "1", features = ["full"] } clap = { version = "4.4", features = ["derive"] } log = "0.4" - -[target.'cfg(target_os = "linux")'.dependencies] -systemd = { version = "0.10", features = ["journal", "vendored"] } +env_logger = "0.11" diff --git a/src/main.rs b/src/main.rs index f0eea31..6e62d9f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,6 +13,7 @@ use crate::serial_input::start_serial_thread; use crate::sync_logic::LtcState; use crate::ui::start_ui; use clap::Parser; +use env_logger; use std::{ fs, @@ -102,17 +103,11 @@ async fn main() { start_ui(ui_state, port, config_clone); }); } else { - println!("🚀 Starting TimeTurner daemon..."); - #[cfg(target_os = "linux")] - { - systemd::journal::init().unwrap(); - log::set_max_level(log::LevelFilter::Info); - log::info!("TimeTurner daemon started. API server is running."); - } - #[cfg(not(target_os = "linux"))] - { - println!("Daemon mode started. API server is running. Logging to system journal is only supported on Linux."); - } + // In daemon mode, we initialize env_logger. + // This will log to stdout, and the systemd service will capture it. + // The RUST_LOG env var controls the log level (e.g., RUST_LOG=info). + env_logger::init(); + log::info!("🚀 Starting TimeTurner daemon..."); } // 6️⃣ Set up a LocalSet for the API server and main loop