Skip to content

Commit

Permalink
char8_t logger (not supported by libfmt by default)
Browse files Browse the repository at this point in the history
  • Loading branch information
Epixu committed Oct 19, 2024
1 parent 054d36d commit f32c2b7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions source/Logger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ namespace Langulus::Logger
template<class T, size_t N>
Interface& operator << (const ::std::array<T, N>&) noexcept;
Interface& operator << (const ::Langulus::Logger::Formattable auto&) noexcept;
Interface& operator << (const char8_t&) noexcept;
};

} // namespace Langulus::Logger::A
Expand Down
9 changes: 9 additions & 0 deletions source/Logger.inl
Original file line number Diff line number Diff line change
Expand Up @@ -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<const char&>(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)
Expand Down

0 comments on commit f32c2b7

Please sign in to comment.