From a9964afcf7ee4f8b487bb3cc3154932f324a39ab Mon Sep 17 00:00:00 2001 From: Gabi Melman Date: Sat, 13 Feb 2021 16:58:04 +0200 Subject: [PATCH] Don't throw wincolor redirection failed, to be consistent with the non-redirect behaviour --- include/spdlog/sinks/wincolor_sink-inl.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/include/spdlog/sinks/wincolor_sink-inl.h b/include/spdlog/sinks/wincolor_sink-inl.h index 59f1d4f4..28cf6f8c 100644 --- a/include/spdlog/sinks/wincolor_sink-inl.h +++ b/include/spdlog/sinks/wincolor_sink-inl.h @@ -155,11 +155,7 @@ void SPDLOG_INLINE wincolor_sink::write_to_file_(const memory_buf_ { auto size = static_cast(formatted.size()); DWORD bytes_written = 0; - bool ok = ::WriteFile(static_cast(out_handle_), formatted.data(), size, &bytes_written, nullptr) != 0; - if (!ok) - { - throw_spdlog_ex("wincolor_sink: ::WriteFile() failed. GetLastError(): " + std::to_string(::GetLastError())); - } + ::WriteFile(static_cast(out_handle_), formatted.data(), size, &bytes_written, nullptr); } // wincolor_stdout_sink