From cae749fc9b140a0fb275b25857d877fd556093a8 Mon Sep 17 00:00:00 2001 From: Josh Junon Date: Thu, 18 Jan 2018 15:03:52 +0100 Subject: [PATCH] clear line after writing log message contents --- include/spdlog/sinks/ansicolor_sink.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/spdlog/sinks/ansicolor_sink.h b/include/spdlog/sinks/ansicolor_sink.h index a487f13f..517003a2 100644 --- a/include/spdlog/sinks/ansicolor_sink.h +++ b/include/spdlog/sinks/ansicolor_sink.h @@ -56,6 +56,7 @@ public: const std::string blink = "\033[5m"; const std::string reverse = "\033[7m"; const std::string concealed = "\033[8m"; + const std::string clear_line = "\033[K"; // Foreground colors const std::string black = "\033[30m"; @@ -88,6 +89,7 @@ protected: fwrite(prefix.data(), sizeof(char), prefix.size(), target_file_); fwrite(msg.formatted.data(), sizeof(char), msg.formatted.size(), target_file_); fwrite(reset.data(), sizeof(char), reset.size(), target_file_); + fwrite(clear_line.data(), sizeof(char), clear_line.size(), target_file_); } else {