mirror of
https://github.com/cjfranko/NTP-Timeturner.git
synced 2025-11-08 18:32:02 +00:00
refactor: replace systemd logger with env_logger
Co-authored-by: aider (gemini/gemini-2.5-pro-preview-05-06) <aider@aider.chat>
This commit is contained in:
parent
cd737b895e
commit
ec132a2840
2 changed files with 7 additions and 14 deletions
17
src/main.rs
17
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue