17 #include <util/pragma_push.def>
19 #pragma warning(disable:4668)
21 #pragma warning(disable : 5039)
28 #include <util/pragma_pop.def>
46 : always_flush(_always_flush), is_a_tty(false), use_SGR(false)
49 HANDLE out_handle=GetStdHandle(STD_OUTPUT_HANDLE);
52 if(GetConsoleMode(out_handle, &consoleMode))
56 #ifdef ENABLE_VIRTUAL_TERMINAL_PROCESSING
57 consoleMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
58 if(SetConsoleMode(out_handle, consoleMode))
81 const std::string &message)
90 GetStdHandle((level>1)?STD_OUTPUT_HANDLE:STD_ERROR_HANDLE);
96 if(GetConsoleMode(out_handle, &consoleMode))
99 std::wstring wide_message=
widen(message);
101 DWORD number_written;
104 out_handle, wide_message.c_str(),
105 (DWORD)wide_message.size(), &number_written, NULL);
107 WriteConsoleW(out_handle, L
"\r\n", 2, &number_written, NULL);
115 std::cout << message <<
'\n';
118 std::cerr << message <<
'\n';
126 std::cout << message <<
'\n';
129 std::cerr << message <<
'\n';
141 std::cout << std::flush;
144 std::cerr << std::flush;
bool use_SGR
true if we use ECMA-48 SGR to render colors
bool is_a_tty
true if we are outputting to a proper console
console_message_handlert()
std::string command(unsigned c) const override
Create an ECMA-48 SGR (Select Graphic Rendition) command with given code.
void print(unsigned, const xmlt &) override
virtual void flush(unsigned level) override
virtual void print(unsigned level, const std::string &message)=0
std::string to_string(const string_not_contains_constraintt &expr)
Used for debug printing.
std::wstring widen(const char *s)