Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print timestamp with each status update #1256

Merged
merged 1 commit into from
Oct 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/fj-interop/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ keywords.workspace = true
categories.workspace = true

[dependencies]
chrono = "0.4.22"
fj-math.workspace = true
6 changes: 5 additions & 1 deletion crates/fj-interop/src/status_report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

use std::collections::VecDeque;

use chrono::Local;

/// Struct to store and update status messages
#[derive(Default)]
pub struct StatusReport {
Expand All @@ -16,7 +18,9 @@ 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) {
Expand Down