From ae80119fa862e0c77f96862f313aa8b676179157 Mon Sep 17 00:00:00 2001 From: Neshura Date: Mon, 25 Dec 2023 16:24:40 +0100 Subject: [PATCH] (Systemd) logging crates --- Cargo.toml | 3 +++ src/main.rs | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index cf13fd4..b7b64ec 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,3 +12,6 @@ serde = "1.0.152" serde_derive = "1.0.152" serde_json = "1.0.93" strum_macros = "0.24.3" +log = "^0.4.20" +systemd-journal-logger = "^2.1.1" +confy = "0.5.1" diff --git a/src/main.rs b/src/main.rs index 5f22021..9cae7e1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,6 +3,8 @@ use reqwest::blocking::get; use serde_derive::{Deserialize, Serialize}; use std::{fs, thread::{sleep}}; use chrono::{Utc, Duration}; +use log::{info, warn, error, LevelFilter}; +use systemd_journal_logger::JournalLog; mod config; mod cloudflare; @@ -356,6 +358,8 @@ fn update_dns() { } fn main() { + JournalLog::new().expect("Systemd-Logger crate error").install().expect("Systemd-Logger crate error"); + log::set_max_level(LevelFilter::Info); let mut now = Utc::now() - Duration::seconds(59); let mut current = now;