From f32c2b76c2bcc32b6f36f1edda6c11378cb85b1d Mon Sep 17 00:00:00 2001 From: Dimo Markov Date: Sat, 19 Oct 2024 18:52:43 +0300 Subject: [PATCH] char8_t logger (not supported by libfmt by default) --- source/Logger.hpp | 1 + source/Logger.inl | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/source/Logger.hpp b/source/Logger.hpp index f325a99..f3a8bfb 100644 --- a/source/Logger.hpp +++ b/source/Logger.hpp @@ -355,6 +355,7 @@ namespace Langulus::Logger template Interface& operator << (const ::std::array&) noexcept; Interface& operator << (const ::Langulus::Logger::Formattable auto&) noexcept; + Interface& operator << (const char8_t&) noexcept; }; } // namespace Langulus::Logger::A diff --git a/source/Logger.inl b/source/Logger.inl index c4fe5dc..a9fe4c2 100644 --- a/source/Logger.inl +++ b/source/Logger.inl @@ -101,6 +101,15 @@ namespace Langulus::Logger const auto formatted = fmt::format("{}", anything); return operator << (TextView {formatted}); } + + /// Stringify char8_t + /// @param c - char + /// @return a reference to the logger for chaining + LANGULUS(INLINED) + A::Interface& A::Interface::operator << (const char8_t& c) noexcept { + const auto formatted = fmt::format("{}", reinterpret_cast(c)); + return operator << (TextView {formatted}); + } /// A general new-line write function that continues the last intent/style /// @tparam ...T - a sequence of elements to log (deducible)