From 3489936ebbf6307317e17eee94dc2bcd3c6aa803 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Wed, 3 Apr 2019 08:58:43 +0200 Subject: [PATCH] src/tools/file_logger.rs: change timestamp format to rfc3339 --- src/tools/file_logger.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tools/file_logger.rs b/src/tools/file_logger.rs index 743a4fb4..423e998c 100644 --- a/src/tools/file_logger.rs +++ b/src/tools/file_logger.rs @@ -1,5 +1,5 @@ use failure::*; -use chrono::Local; +use chrono::{TimeZone, Local}; use std::io::Write; /// Log messages with timestamps into files @@ -18,6 +18,7 @@ use std::io::Write; /// ``` +#[derive(Debug)] pub struct FileLogger { file: std::fs::File, to_stdout: bool, @@ -54,8 +55,7 @@ impl FileLogger { stdout.write(b"\n").unwrap(); } - - let line = format!("{}: {}\n", Local::now().format("%b %e %T"), msg); + let line = format!("{}: {}\n", Local.timestamp(Local::now().timestamp(), 0).to_rfc3339(), msg); self.file.write(line.as_bytes()).unwrap(); } }