Skip to content

Commit

Permalink
Merge pull request #582 from JakeRoggenbuck/add-format
Browse files Browse the repository at this point in the history
Format
  • Loading branch information
JakeRoggenbuck authored Nov 27, 2024
2 parents 706c2be + 8e7e946 commit 5c9c6c1
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
//!
//! The log messages contain a timestamp, a severity level and the message. The logs are stored in a vector and are serializable and deserializable. The logs can also be displayed in a human-readable format.
use chrono::{DateTime, Local};
use efcl::{color, Color};
use serde::{Deserialize, Serialize};
use std::fmt;
use std::time::SystemTime;
use chrono::{DateTime, Local};

#[derive(Debug, Eq, PartialEq, Serialize, Deserialize)]
/// The Severity enum is used to represent the different levels of severity of a log message. It has three possible values:
Expand Down Expand Up @@ -45,7 +45,13 @@ impl fmt::Display for Log {

let local_time: DateTime<Local> = DateTime::<Local>::from(self.timestamp);

write!(f, "{} {} -> {}", severity, local_time.format("%Y-%m-%d %H:%M:%S"), self.message)
write!(
f,
"{} {} -> {}",
severity,
local_time.format("%Y-%m-%d %H:%M:%S"),
self.message
)
}
}

Expand Down

0 comments on commit 5c9c6c1

Please sign in to comment.