mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
easylogging++: always omit ANSI codes when colour is not supported
This commit is contained in:
parent
3f6096867d
commit
6d378d90fe
2 changed files with 9 additions and 3 deletions
11
external/easylogging++/easylogging++.cc
vendored
11
external/easylogging++/easylogging++.cc
vendored
|
@ -684,6 +684,11 @@ void LogBuilder::convertToColoredOutput(base::type::string_t* logLine, Level lev
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LogBuilder::setColor(Color color, bool bright) {
|
||||||
|
if (m_termSupportsColor)
|
||||||
|
el::base::utils::setConsoleColor(color, bright);
|
||||||
|
}
|
||||||
|
|
||||||
// Logger
|
// Logger
|
||||||
|
|
||||||
Logger::Logger(const std::string& id, base::LogStreamsReferenceMap* logStreamsReference) :
|
Logger::Logger(const std::string& id, base::LogStreamsReferenceMap* logStreamsReference) :
|
||||||
|
@ -2485,11 +2490,11 @@ void DefaultLogDispatchCallback::dispatch(base::type::string_t&& rawLinePrefix,
|
||||||
if (m_data->logMessage()->logger()->m_typedConfigurations->toStandardOutput(m_data->logMessage()->level())) {
|
if (m_data->logMessage()->logger()->m_typedConfigurations->toStandardOutput(m_data->logMessage()->level())) {
|
||||||
const el::Level level = m_data->logMessage()->level();
|
const el::Level level = m_data->logMessage()->level();
|
||||||
const el::Color color = m_data->logMessage()->color();
|
const el::Color color = m_data->logMessage()->color();
|
||||||
el::base::utils::setConsoleColor(el::base::utils::colorFromLevel(level), false);
|
m_data->logMessage()->logger()->logBuilder()->setColor(el::base::utils::colorFromLevel(level), false);
|
||||||
ELPP_COUT << rawLinePrefix;
|
ELPP_COUT << rawLinePrefix;
|
||||||
el::base::utils::setConsoleColor(color == el::Color::Default ? el::base::utils::colorFromLevel(level): color, color != el::Color::Default);
|
m_data->logMessage()->logger()->logBuilder()->setColor(color == el::Color::Default ? el::base::utils::colorFromLevel(level): color, color != el::Color::Default);
|
||||||
ELPP_COUT << rawLinePayload;
|
ELPP_COUT << rawLinePayload;
|
||||||
el::base::utils::setConsoleColor(el::Color::Default, false);
|
m_data->logMessage()->logger()->logBuilder()->setColor(el::Color::Default, false);
|
||||||
ELPP_COUT << std::flush;
|
ELPP_COUT << std::flush;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
1
external/easylogging++/easylogging++.h
vendored
1
external/easylogging++/easylogging++.h
vendored
|
@ -2235,6 +2235,7 @@ class LogBuilder : base::NoCopy {
|
||||||
}
|
}
|
||||||
virtual base::type::string_t build(const LogMessage* logMessage, bool appendNewLine) const = 0;
|
virtual base::type::string_t build(const LogMessage* logMessage, bool appendNewLine) const = 0;
|
||||||
void convertToColoredOutput(base::type::string_t* logLine, Level level, Color color);
|
void convertToColoredOutput(base::type::string_t* logLine, Level level, Color color);
|
||||||
|
void setColor(Color color, bool bright);
|
||||||
private:
|
private:
|
||||||
bool m_termSupportsColor;
|
bool m_termSupportsColor;
|
||||||
friend class el::base::DefaultLogDispatchCallback;
|
friend class el::base::DefaultLogDispatchCallback;
|
||||||
|
|
Loading…
Reference in a new issue