From 3848cbe24acc07e04c323f67ac2af2fe053cbc7c Mon Sep 17 00:00:00 2001 From: gabime Date: Mon, 24 Feb 2020 17:00:35 +0200 Subject: [PATCH] Fix #1452 --- include/spdlog/sinks/ansicolor_sink-inl.h | 2 +- include/spdlog/sinks/wincolor_sink-inl.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/spdlog/sinks/ansicolor_sink-inl.h b/include/spdlog/sinks/ansicolor_sink-inl.h index 58fa53fe..c75072af 100644 --- a/include/spdlog/sinks/ansicolor_sink-inl.h +++ b/include/spdlog/sinks/ansicolor_sink-inl.h @@ -43,7 +43,7 @@ SPDLOG_INLINE void ansicolor_sink::log(const details::log_msg &msg // Wrap the originally formatted message in color codes. // If color is not supported in the terminal, log as is instead. std::lock_guard lock(mutex_); - + msg.color_range_start = msg.color_range_end = 0; memory_buf_t formatted; formatter_->format(msg, formatted); if (should_do_colors_ && msg.color_range_end > msg.color_range_start) diff --git a/include/spdlog/sinks/wincolor_sink-inl.h b/include/spdlog/sinks/wincolor_sink-inl.h index 6ce9cac3..52a82af8 100644 --- a/include/spdlog/sinks/wincolor_sink-inl.h +++ b/include/spdlog/sinks/wincolor_sink-inl.h @@ -52,6 +52,7 @@ template void SPDLOG_INLINE wincolor_sink::log(const details::log_msg &msg) { std::lock_guard lock(mutex_); + msg.color_range_start = msg.color_range_end = 0; memory_buf_t formatted; formatter_->format(msg, formatted); if (!in_console_) @@ -59,7 +60,6 @@ void SPDLOG_INLINE wincolor_sink::log(const details::log_msg &msg) write_to_file_(formatted); return; } - if (should_do_colors_ && msg.color_range_end > msg.color_range_start) { // before color range