logbuffer crash fix (#2524)

This commit is contained in:
Zach H 2017-03-22 21:39:16 -04:00 committed by GitHub
parent f688c046ab
commit 317ac05919

View file

@ -51,16 +51,18 @@ void Logger::closeLogfileSession()
void Logger::log(QtMsgType /* type */, const QMessageLogContext & /* ctx */, const QString &message)
{
logBuffer.append(message);
if(logBuffer.size() > LOGGER_MAX_ENTRIES)
logBuffer.removeFirst();
if (logBuffer.size() > LOGGER_MAX_ENTRIES)
logBuffer.clear();
if (message.size() > 0)
if (message.size() > 0) {
emit logEntryAdded(message);
std::cerr << message.toStdString() << std::endl; // Print to stdout
if (logToFileEnabled)
fileStream << message << endl; // Print to fileStream
}
std::cerr << message.toStdString() << std::endl; // Print to stdout
if (logToFileEnabled)
fileStream << message << endl; // Print to fileStream
}