16 const config streamConfig = optStreamConfig ? *optStreamConfig :
config();
18 if (streamConfig.bDisableStdioSync)
20 std::ios_base::sync_with_stdio(
false);
23 if (streamConfig.bUntieCin)
25 std::cout.tie(
nullptr);
26 std::cerr.tie(
nullptr);
32 std::cout << std::flush;
33 std::cerr << std::flush;
36 inline void cout_logger_stream::cout_colorized(verbosity eVerbosity, string_view svMessage,
const color& rangeColor)
40 std::ostream& outputStream = !
is_error(eVerbosity) ? std::cout : std::cerr;
41 const cstring_view svUtf8 =
to_utf8(svMessage);
43 outputStream.write(svUtf8.data(),
static_cast<std::streamsize
>(svUtf8.size()));
47 inline void cout_logger_stream::cout_common(verbosity eVerbosity, string_view svMessage)
51 std::ostream& outputStream = !is_error(eVerbosity) ? std::cout : std::cerr;
52 const cstring_view svUtf8 =
to_utf8(svMessage);
53 outputStream.write(svUtf8.data(),
static_cast<std::streamsize
>(svUtf8.size()));
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.
cout_logger_stream(std::optional< config > optStreamConfig={}) noexcept
cout_logger_stream object constructor
virtual void do_flush() override
Flush the stream.
static constexpr terminal_color reset() noexcept
Reset all colors.
static constexpr terminal_color font(const color &fontColor) noexcept
Set font color.
constexpr bool is_error(verbosity eVerbosity) noexcept
Check if the verbosity level is an error.