From 42f653ab6fc8ab07ba0db4ffb4d2b0267115a588 Mon Sep 17 00:00:00 2001 From: liushuyu Date: Sat, 8 Jan 2022 01:48:53 -0700 Subject: logging: adapt to changes in fmt 8.1 --- src/common/logging/log.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/common') diff --git a/src/common/logging/log.h b/src/common/logging/log.h index c186d55ef..b6a14972f 100644 --- a/src/common/logging/log.h +++ b/src/common/logging/log.h @@ -6,11 +6,24 @@ #include #include +#include -#include +#include #include "common/logging/types.h" +// adapted from https://github.com/fmtlib/fmt/issues/2704 +// a generic formatter for enum classes (<= 32 bits) +#if FMT_VERSION >= 80100 +template +struct fmt::formatter, char>> : formatter { + template + auto format(const T& value, FormatContext& ctx) -> decltype(ctx.out()) { + return fmt::formatter::format(static_cast(value), ctx); + } +}; +#endif + namespace Common::Log { // trims up to and including the last of ../, ..\, src/, src\ in a string -- cgit v1.2.3