Added command-line option to autodetect, enable, or disable color output.

This commit is contained in:
2016-06-14 18:02:59 +02:00
parent aff396d919
commit eb3d91f085
5 changed files with 73 additions and 21 deletions

View File

@@ -43,8 +43,8 @@ Logger &Logger::operator=(const Logger &other)
////////////////////////////////////////////////////////////////////////////////////////////////////
Logger::Logger(Logger &&other)
: m_outputStream{other.m_outputStream},
m_errorStream{other.m_errorStream},
: m_outputStream{std::move(other.m_outputStream)},
m_errorStream{std::move(other.m_errorStream)},
m_warningLevel{other.m_warningLevel}
{
other.m_warningLevel = WarningLevel::Normal;
@@ -54,9 +54,10 @@ Logger::Logger(Logger &&other)
Logger &Logger::operator=(Logger &&other)
{
m_outputStream = other.m_outputStream;
m_errorStream = other.m_errorStream;
m_outputStream = std::move(other.m_outputStream);
m_errorStream = std::move(other.m_errorStream);
m_warningLevel = other.m_warningLevel;
other.m_warningLevel = WarningLevel::Normal;
return *this;
@@ -85,6 +86,14 @@ void Logger::setWarningLevel(WarningLevel warningLevel)
////////////////////////////////////////////////////////////////////////////////////////////////////
void Logger::setColorPolicy(LogStream::ColorPolicy colorPolicy)
{
m_outputStream.setColorPolicy(colorPolicy);
m_errorStream.setColorPolicy(colorPolicy);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
void Logger::logError(const std::string &message)
{
m_errorStream