From 62d177be28b61736be75f4c38eea742b2617e44e Mon Sep 17 00:00:00 2001 From: Christopher Torres Date: Thu, 14 Apr 2016 12:08:38 -0400 Subject: [PATCH] Handle changing the colors of STD_ERROR_HANDLE as well --- include/spdlog/sinks/wincolor_sink.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/spdlog/sinks/wincolor_sink.h b/include/spdlog/sinks/wincolor_sink.h index 7540e6a8..74870bb5 100644 --- a/include/spdlog/sinks/wincolor_sink.h +++ b/include/spdlog/sinks/wincolor_sink.h @@ -103,12 +103,14 @@ inline void wincolor_sink::log(const details::log_msg& msg) // Wrap the originally formatted message in color codes #ifdef _WIN32 SetConsoleTextAttribute(GetStdHandle( STD_OUTPUT_HANDLE ), colors_[msg.level]); + SetConsoleTextAttribute(GetStdHandle( STD_ERROR_HANDLE ), colors_[msg.level]); #endif sink_->log( msg ); #ifdef _WIN32 - SetConsoleTextAttribute( GetStdHandle( STD_OUTPUT_HANDLE ), reset ); + SetConsoleTextAttribute(GetStdHandle( STD_ERROR_HANDLE ), reset); + SetConsoleTextAttribute(GetStdHandle( STD_OUTPUT_HANDLE ), reset); #endif }