24 inline void fwrite_logger_stream::cout_colorized(verbosity eVerbosity, string_view svMessage,
const color& rangeColor)
28 FILE* output = !
is_error(eVerbosity) ? stdout : stderr;
29 const cstring_view svUtf8 =
to_utf8(svMessage);
31 fwrite(svUtf8.data(),
sizeof(
char), svUtf8.size(), output);
35 inline void fwrite_logger_stream::cout_common(verbosity eVerbosity, string_view svMessage)
39 FILE* output = !is_error(eVerbosity) ? stdout : stderr;
40 const cstring_view svUtf8 =
to_utf8(svMessage);
41 fwrite(svUtf8.data(),
sizeof(
char), svUtf8.size(), output);
static cstring_view to_utf8(string_view svMessage)
Encode a message as UTF-8 for a byte output.
A base class for logger streams based on standard streams.
void check_previous_message(verbosity eCurrentMessageVerbosity)
Check the previous message type and flush if needed.
virtual void do_flush() override
Flush the stream.
fwrite_logger_stream(const config &streamConfig=config()) noexcept
fwrite_logger_stream object constructor
static constexpr terminal_color reset() noexcept
Reset all colors.
static constexpr terminal_color font(const color &fontColor) noexcept
Set font color.
void write(FILE *pStream) const
Write terminal color to the specified stream.
constexpr bool is_error(verbosity eVerbosity) noexcept
Check if the verbosity level is an error.