From cfbf00d625ba3af6241f2a5039e6f853f57acf08 Mon Sep 17 00:00:00 2001 From: erenoku Date: Sun, 23 Oct 2022 12:23:14 +0300 Subject: [PATCH] Print timestamp with each status update --- Cargo.lock | 1 + crates/fj-interop/Cargo.toml | 1 + crates/fj-interop/src/status_report.rs | 5 ++++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index e9be735fdf..cd02626ed5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1006,6 +1006,7 @@ dependencies = [ name = "fj-interop" version = "0.20.0" dependencies = [ + "chrono", "fj-math", ] diff --git a/crates/fj-interop/Cargo.toml b/crates/fj-interop/Cargo.toml index e40226a366..cf6bf44e5f 100644 --- a/crates/fj-interop/Cargo.toml +++ b/crates/fj-interop/Cargo.toml @@ -11,4 +11,5 @@ keywords.workspace = true categories.workspace = true [dependencies] +chrono = "0.4.22" fj-math.workspace = true diff --git a/crates/fj-interop/src/status_report.rs b/crates/fj-interop/src/status_report.rs index f5c645da2b..8d027dc51e 100644 --- a/crates/fj-interop/src/status_report.rs +++ b/crates/fj-interop/src/status_report.rs @@ -2,6 +2,8 @@ use std::collections::VecDeque; +use chrono::Local; + /// Struct to store and update status messages #[derive(Default)] pub struct StatusReport { @@ -16,7 +18,8 @@ impl StatusReport { /// Update the status pub fn update_status(&mut self, status: &str) { - let status = format!("\n{}", status.to_owned()); + let date = Local::now(); + let status = format!("\n{} {}", date.format("[%H:%M:%S]"), status.to_owned()); self.status.push_back(status); if self.status.len() > 5 { for _ in 0..(self.status.len() - 5) {