mirror of
https://github.com/LastExceed/spacermake.git
synced 2025-03-12 15:01:44 +01:00
add startup debug log
This commit is contained in:
parent
d5f92d31bd
commit
124bdab3a8
@ -8,6 +8,8 @@ use state::{Announcer, Listener, State};
|
|||||||
|
|
||||||
use utils::parse_toml_file;
|
use utils::parse_toml_file;
|
||||||
|
|
||||||
|
use crate::utils::logs::log_start;
|
||||||
|
|
||||||
mod state;
|
mod state;
|
||||||
mod utils;
|
mod utils;
|
||||||
|
|
||||||
@ -34,6 +36,7 @@ lazy_static! {
|
|||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
magenta_ln!("===== spacermake =====");
|
magenta_ln!("===== spacermake =====");
|
||||||
|
log_start().expect("startup log failed");
|
||||||
print_config();
|
print_config();
|
||||||
let (client, event_loop) = create_client().await;
|
let (client, event_loop) = create_client().await;
|
||||||
magenta_ln!("start");
|
magenta_ln!("start");
|
||||||
|
@ -45,6 +45,13 @@ pub fn machinelog(machine: &str, booking: &Booking) -> io::Result<()> {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn log_start() -> io::Result<()> {
|
||||||
|
File::options()
|
||||||
|
.append(true)
|
||||||
|
.open("/root/machinelog_debug.csv")?
|
||||||
|
.write_all(format!("\n\n===== startup {} =====\n\n", Local::now()).as_bytes())
|
||||||
|
}
|
||||||
|
|
||||||
pub fn log_debug(topic: &str, payload: &str, result: Result<(), &str>) -> io::Result<()> {
|
pub fn log_debug(topic: &str, payload: &str, result: Result<(), &str>) -> io::Result<()> {
|
||||||
if let Err(error) = result {
|
if let Err(error) = result {
|
||||||
red_ln!("error: {error}");
|
red_ln!("error: {error}");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user