Log: add libfmt support
This commit is contained in:
11
src/Log.cxx
11
src/Log.cxx
@@ -21,6 +21,8 @@
|
||||
#include "util/Domain.hxx"
|
||||
#include "util/Exception.hxx"
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include <cerrno>
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -28,6 +30,15 @@
|
||||
|
||||
static constexpr Domain exception_domain("exception");
|
||||
|
||||
void
|
||||
LogVFmt(LogLevel level, const Domain &domain,
|
||||
fmt::string_view format_str, fmt::format_args args) noexcept
|
||||
{
|
||||
fmt::memory_buffer buffer;
|
||||
fmt::vformat_to(buffer, format_str, args);
|
||||
Log(level, domain, {buffer.data(), buffer.size()});
|
||||
}
|
||||
|
||||
void
|
||||
LogFormatV(LogLevel level, const Domain &domain,
|
||||
const char *fmt, std::va_list ap) noexcept
|
||||
|
Reference in New Issue
Block a user