log in local time

This commit is contained in:
Drath Vader
2025-10-24 15:10:32 +02:00
parent 3ccaa513b3
commit 019a25eda2

View File

@@ -49,7 +49,8 @@ inline void _log(LOG level, std::string_view tag, std::format_string<Args...> st
/* log to file */
if (logToFile) {
auto now = std::chrono::system_clock::now();
std::string msg = std::format("{:%x %H:%M:%S }", floor<std::chrono::milliseconds>(now)); // timestamp
auto local = std::chrono::current_zone()->to_local(now);
std::string msg = std::format("{:%x %H:%M:%S }", floor<std::chrono::milliseconds>(local)); // timestamp
std::format_to(std::back_inserter(msg), pattern, color, tag, reset); // tag
std::format_to(std::back_inserter(msg), str, std::forward<Args>(args)...); // actual log message