You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.0 KiB

  1. From 82d84ac5e62c23e717198fc7b2ef190ff95e70d1 Mon Sep 17 00:00:00 2001
  2. From: kyak <bas@bmail.ru>
  3. Date: Wed, 12 Jan 2022 19:41:37 +0300
  4. Subject: [PATCH] Fix for fmt > 8.0
  5. ---
  6. src/util/logger.h | 15 +++++++++++++++
  7. 1 file changed, 15 insertions(+)
  8. --- a/src/util/logger.h
  9. +++ b/src/util/logger.h
  10. @@ -32,7 +32,9 @@
  11. #ifndef __LOGGER_H__
  12. #define __LOGGER_H__
  13. +#include <fmt/format.h>
  14. #include <spdlog/spdlog.h>
  15. +#include <type_traits>
  16. #define log_debug SPDLOG_DEBUG
  17. #define log_info SPDLOG_INFO
  18. @@ -40,4 +42,17 @@
  19. #define log_error SPDLOG_ERROR
  20. #define log_js SPDLOG_INFO
  21. +#if FMT_VERSION >= 80100
  22. +template <typename T>
  23. +struct fmt::formatter<T, std::enable_if_t<std::is_enum_v<T>, char>>
  24. + : formatter<std::underlying_type_t<T>> {
  25. + template <typename FormatContext>
  26. + auto format(const T& value, FormatContext& ctx) -> decltype(ctx.out())
  27. + {
  28. + return fmt::formatter<std::underlying_type_t<T>>::format(
  29. + static_cast<std::underlying_type_t<T>>(value), ctx);
  30. + }
  31. +};
  32. +#endif
  33. +
  34. #endif // __LOGGER_H__