diff --git a/src/common/logging/formatter.h b/src/common/logging/formatter.h index f80905cc3..2ad481b12 100644 --- a/src/common/logging/formatter.h +++ b/src/common/logging/formatter.h @@ -19,3 +19,27 @@ struct fmt::formatter, char>> } }; #endif + +namespace fmt { +template +struct UTF { + T data; + + explicit UTF(const std::u8string_view view) { + data = T{(const char*)&view.front(), (const char*)&view.back()}; + } + + explicit UTF(const std::u8string& str) + : UTF(std::u8string_view{str}) { + } +}; +} + +template <> +struct fmt::formatter, char> + : formatter { + template + auto format(const UTF& wrapper, FormatContext& ctx) const { + return formatter::format(wrapper.data, ctx); + } +}; \ No newline at end of file