Skip to content

Commit

Permalink
feat: set time format for logger
Browse files Browse the repository at this point in the history
  • Loading branch information
SkuldNorniern committed Mar 13, 2024
1 parent 8097197 commit d8ee1cb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,9 @@ impl Log for Logger {
}

fn log(&self, record: &Record) {
let timestamp = Local::now();
let formatted_message = format!("{} [{}]: {}", timestamp, record.level(), record.args());
// Y M S, H:M:S Timezone
let timestamp = Local::now().format("%Y-%m-%d %H:%M:%S %z").to_string();
let formatted_message = format!("[{}] [{}]: {}", timestamp, record.level(), record.args());

if self.write_to_std.as_ref().is_some() && record.level() <= self.severity {
match self.write_to_std.as_ref().unwrap() {
Expand Down

0 comments on commit d8ee1cb

Please sign in to comment.