Add timestamps to logs

This commit is contained in:
Siarhei Fedartsou 2022-09-27 20:32:28 +02:00
parent e685f81d28
commit 1ad58d0096

View File

@ -76,8 +76,9 @@ void Log::Init()
const bool is_terminal = IsStdoutATTY(); const bool is_terminal = IsStdoutATTY();
auto format = [is_terminal](const char *level, const char *color) { auto format = [is_terminal](const char *level, const char *color) {
const auto timestamp = std::chrono::system_clock::now();
return fmt::format( 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) switch (level)