+ if (colored_message) {
+ // reset to white color
+ m_stream << "\033[0m";
+ }
+}
+
+void LogOutputBuffer::updateLogLevel()
+{
+ const std::string &conf_loglev = g_settings->get("chat_log_level");
+ LogLevel log_level = Logger::stringToLevel(conf_loglev);
+ if (log_level == LL_MAX) {
+ warningstream << "Supplied unrecognized chat_log_level; "
+ "showing none." << std::endl;
+ log_level = LL_NONE;
+ }
+
+ m_logger.removeOutput(this);
+ m_logger.addOutputMaxLevel(this, log_level);
+}
+
+void LogOutputBuffer::logRaw(LogLevel lev, const std::string &line)
+{
+ std::string color;
+
+ if (!g_settings->getBool("disable_escape_sequences")) {
+ switch (lev) {
+ case LL_ERROR: // red
+ color = "\x1b(c@#F00)";
+ break;
+ case LL_WARNING: // yellow
+ color = "\x1b(c@#EE0)";
+ break;
+ case LL_INFO: // grey
+ color = "\x1b(c@#BBB)";
+ break;
+ case LL_VERBOSE: // dark grey
+ color = "\x1b(c@#888)";
+ break;
+ default: break;
+ }
+ }
+
+ m_buffer.push(color.append(line));
+}