From a59f74e8a2a33a45bce11507c75fc9730e0ddd56 Mon Sep 17 00:00:00 2001 From: Josh Junon Date: Thu, 18 Jan 2018 15:03:03 +0100 Subject: [PATCH 1/3] remove needless zeros in reset code --- include/spdlog/sinks/ansicolor_sink.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/spdlog/sinks/ansicolor_sink.h b/include/spdlog/sinks/ansicolor_sink.h index 29097313..0a9bde35 100644 --- a/include/spdlog/sinks/ansicolor_sink.h +++ b/include/spdlog/sinks/ansicolor_sink.h @@ -49,7 +49,7 @@ public: } /// Formatting codes - const std::string reset = "\033[00m"; + const std::string reset = "\033[m"; const std::string bold = "\033[1m"; const std::string dark = "\033[2m"; const std::string underline = "\033[4m"; From 58e68725ae22023f09711d3b06cdb8a570c65bea Mon Sep 17 00:00:00 2001 From: Josh Junon Date: Thu, 18 Jan 2018 15:03:26 +0100 Subject: [PATCH 2/3] rename grey to black --- include/spdlog/sinks/ansicolor_sink.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/spdlog/sinks/ansicolor_sink.h b/include/spdlog/sinks/ansicolor_sink.h index 0a9bde35..a487f13f 100644 --- a/include/spdlog/sinks/ansicolor_sink.h +++ b/include/spdlog/sinks/ansicolor_sink.h @@ -58,7 +58,7 @@ public: const std::string concealed = "\033[8m"; // Foreground colors - const std::string grey = "\033[30m"; + const std::string black = "\033[30m"; const std::string red = "\033[31m"; const std::string green = "\033[32m"; const std::string yellow = "\033[33m"; @@ -68,7 +68,7 @@ public: const std::string white = "\033[37m"; /// Background colors - const std::string on_grey = "\033[40m"; + const std::string on_black = "\033[40m"; const std::string on_red = "\033[41m"; const std::string on_green = "\033[42m"; const std::string on_yellow = "\033[43m"; From cae749fc9b140a0fb275b25857d877fd556093a8 Mon Sep 17 00:00:00 2001 From: Josh Junon Date: Thu, 18 Jan 2018 15:03:52 +0100 Subject: [PATCH 3/3] 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 {