mirror of
https://github.com/LastExceed/spacermake.git
synced 2025-03-12 06:51:43 +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 crate::utils::logs::log_start;
|
||||
|
||||
mod state;
|
||||
mod utils;
|
||||
|
||||
@ -34,6 +36,7 @@ lazy_static! {
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
magenta_ln!("===== spacermake =====");
|
||||
log_start().expect("startup log failed");
|
||||
print_config();
|
||||
let (client, event_loop) = create_client().await;
|
||||
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<()> {
|
||||
if let Err(error) = result {
|
||||
red_ln!("error: {error}");
|
||||
|
Loading…
x
Reference in New Issue
Block a user