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