diff options
Diffstat (limited to 'src/common/logging/log.h')
| -rw-r--r-- | src/common/logging/log.h | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/src/common/logging/log.h b/src/common/logging/log.h index 096a441b8..0c80d01ee 100644 --- a/src/common/logging/log.h +++ b/src/common/logging/log.h | |||
| @@ -6,26 +6,12 @@ | |||
| 6 | 6 | ||
| 7 | #include <algorithm> | 7 | #include <algorithm> |
| 8 | #include <string_view> | 8 | #include <string_view> |
| 9 | #include <type_traits> | ||
| 10 | 9 | ||
| 11 | #include <fmt/format.h> | 10 | #include <fmt/format.h> |
| 12 | 11 | ||
| 12 | #include "common/logging/formatter.h" | ||
| 13 | #include "common/logging/types.h" | 13 | #include "common/logging/types.h" |
| 14 | 14 | ||
| 15 | // adapted from https://github.com/fmtlib/fmt/issues/2704 | ||
| 16 | // a generic formatter for enum classes (<= 32 bits) | ||
| 17 | #if FMT_VERSION >= 80100 | ||
| 18 | template <typename T> | ||
| 19 | struct fmt::formatter<T, std::enable_if_t<std::is_enum_v<T>, char>> | ||
| 20 | : formatter<std::underlying_type_t<T>> { | ||
| 21 | template <typename FormatContext> | ||
| 22 | auto format(const T& value, FormatContext& ctx) -> decltype(ctx.out()) { | ||
| 23 | return fmt::formatter<std::underlying_type_t<T>>::format( | ||
| 24 | static_cast<std::underlying_type_t<T>>(value), ctx); | ||
| 25 | } | ||
| 26 | }; | ||
| 27 | #endif | ||
| 28 | |||
| 29 | namespace Common::Log { | 15 | namespace Common::Log { |
| 30 | 16 | ||
| 31 | // trims up to and including the last of ../, ..\, src/, src\ in a string | 17 | // trims up to and including the last of ../, ..\, src/, src\ in a string |