LogBackend: include year in time stamp

Also use a numeric month instead of the month name.
This commit is contained in:
Max Kellermann
2025-03-13 08:59:55 +01:00
parent 84ff3c6a0d
commit 689d231809
2 changed files with 3 additions and 2 deletions
+2 -2
View File
@@ -81,10 +81,10 @@ EnableLogTimestamp() noexcept
static std::string_view
log_date() noexcept
{
static constexpr size_t LOG_DATE_BUF_SIZE = std::char_traits<char>::length("Jan 22 15:43:14 : ") + 1;
static constexpr size_t LOG_DATE_BUF_SIZE = std::char_traits<char>::length("2025-01-22 15:43:14 : ") + 1;
static char buf[LOG_DATE_BUF_SIZE];
time_t t = time(nullptr);
return FmtUnsafeSV(buf, "{:%b %d %T} : "sv, fmt::localtime(t));
return FmtUnsafeSV(buf, "{:%F %T} : "sv, fmt::localtime(t));
}
#ifdef HAVE_SYSLOG