From 1e80ec7ac6983eb18d3f95dee8f81eb13118a12e Mon Sep 17 00:00:00 2001 From: Jochen Topf Date: Sun, 6 Dec 2020 10:06:33 +0100 Subject: [PATCH] Decouple color output from log settings Always use color when writing to console and no color otherwise. --- src/logging.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/logging.hpp b/src/logging.hpp index af9e0a463..6a5b93bf4 100644 --- a/src/logging.hpp +++ b/src/logging.hpp @@ -35,7 +35,7 @@ class logger return; } - auto const &ts = m_show_progress ? style : fmt::text_style{}; + auto const &ts = m_use_color ? style : fmt::text_style{}; std::string str = "{:%Y-%m-%d %H:%M:%S} "_format(fmt::localtime(std::time(nullptr))); @@ -71,6 +71,7 @@ class logger bool m_log_sql = false; bool m_log_sql_data = false; bool m_show_progress = true; + bool m_use_color = osmium::util::isatty(2); }; // class logger