From 1ad58d0096d4105faf571275611742fb546c15cf Mon Sep 17 00:00:00 2001 From: Siarhei Fedartsou Date: Tue, 27 Sep 2022 20:32:28 +0200 Subject: [PATCH] Add timestamps to logs --- src/util/log.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/util/log.cpp b/src/util/log.cpp index c26802b2c..3d52a11c7 100644 --- a/src/util/log.cpp +++ b/src/util/log.cpp @@ -76,8 +76,9 @@ void Log::Init() const bool is_terminal = IsStdoutATTY(); auto format = [is_terminal](const char *level, const char *color) { + const auto timestamp = std::chrono::system_clock::now(); return fmt::format( - "{}[{}] [{}] ", is_terminal ? color : "", std::chrono::system_clock::now(), level); + "{}[{:%FT%H:%M:}{:%S}] [{}] ", is_terminal ? color : "", timestamp, timestamp.time_since_epoch(), level); }; switch (level)