From a35a4f48a802f2039e0bf559893ccfc607640cef Mon Sep 17 00:00:00 2001 From: Alexey Rybalchenko Date: Tue, 23 Jan 2018 16:31:37 +0100 Subject: [PATCH] Logger: output only to stdout --- logger/Logger.cxx | 24 ++---------------------- logger/Logger.h | 3 --- 2 files changed, 2 insertions(+), 25 deletions(-) diff --git a/logger/Logger.cxx b/logger/Logger.cxx index 582183f..3d7f602 100644 --- a/logger/Logger.cxx +++ b/logger/Logger.cxx @@ -124,7 +124,6 @@ class ColoredSeverityWriter }; bool Logger::fColored = false; -bool Logger::fCerrOnly = false; fstream Logger::fFileStream; Logger::Verbosity Logger::fVerbosity = Logger::Verbosity::low; Logger::Severity Logger::fConsoleSeverity = Logger::Severity::info; @@ -441,11 +440,6 @@ void Logger::OnFatal(std::function func) fFatalCallback = func; } -void Logger::SetCerrOnly(bool cerrOnly) -{ - fCerrOnly = cerrOnly; -} - Logger::~Logger() noexcept(false) { fContent << "\n"; // "\n" + flush instead of endl makes output thread safe. @@ -457,25 +451,11 @@ Logger::~Logger() noexcept(false) if (fColored) { fColorOut << fContent.str(); - if (fCurrentSeverity == Severity::fatal || fCurrentSeverity == Severity::error || fCerrOnly) - { - cerr << fColorOut.str() << flush; - } - else - { - cout << fColorOut.str() << flush; - } + cout << fColorOut.str() << flush; } else { - if (fCurrentSeverity == Severity::fatal || fCurrentSeverity == Severity::error || fCerrOnly) - { - cerr << fBWOut.str() << flush; - } - else - { - cout << fBWOut.str() << flush; - } + cout << fBWOut.str() << flush; } } diff --git a/logger/Logger.h b/logger/Logger.h index 9674899..14a606a 100644 --- a/logger/Logger.h +++ b/logger/Logger.h @@ -127,8 +127,6 @@ class Logger static void OnFatal(std::function func); - static void SetCerrOnly(bool cerrOnly); - virtual ~Logger() noexcept(false); private: @@ -139,7 +137,6 @@ class Logger std::ostringstream fBWOut; static const std::string fProcessName; static bool fColored; - static bool fCerrOnly; static std::fstream fFileStream; static Severity fConsoleSeverity;