LogBackend: use fmt::print()

This commit is contained in:
Max Kellermann 2023-03-14 20:23:13 +01:00
parent 119a949bb5
commit b4d0b23369
1 changed files with 6 additions and 6 deletions

View File

@ -83,6 +83,8 @@ log_date() noexcept
return buf;
}
#ifdef HAVE_SYSLOG
/**
* Determines the length of the string excluding trailing whitespace
* characters.
@ -93,8 +95,6 @@ chomp_length(std::string_view p) noexcept
return StripRight(p.data(), p.size());
}
#ifdef HAVE_SYSLOG
[[gnu::const]]
static int
ToSysLogLevel(LogLevel log_level) noexcept
@ -147,10 +147,10 @@ LogFinishSysLog() noexcept
static void
FileLog(const Domain &domain, std::string_view message) noexcept
{
fprintf(stderr, "%s%s: %.*s\n",
enable_timestamp ? log_date() : "",
domain.GetName(),
chomp_length(message), message.data());
fmt::print("{}{}: {}\n",
enable_timestamp ? log_date() : "",
domain.GetName(),
StripRight(message));
#ifdef _WIN32
/* force-flush the log file, because setvbuf() does not seem