logbuffer crash fix (#2524)
This commit is contained in:
parent
f688c046ab
commit
317ac05919
1 changed files with 8 additions and 6 deletions
|
@ -51,16 +51,18 @@ void Logger::closeLogfileSession()
|
||||||
void Logger::log(QtMsgType /* type */, const QMessageLogContext & /* ctx */, const QString &message)
|
void Logger::log(QtMsgType /* type */, const QMessageLogContext & /* ctx */, const QString &message)
|
||||||
{
|
{
|
||||||
logBuffer.append(message);
|
logBuffer.append(message);
|
||||||
if(logBuffer.size() > LOGGER_MAX_ENTRIES)
|
if (logBuffer.size() > LOGGER_MAX_ENTRIES)
|
||||||
logBuffer.removeFirst();
|
logBuffer.clear();
|
||||||
|
|
||||||
if (message.size() > 0)
|
if (message.size() > 0) {
|
||||||
emit logEntryAdded(message);
|
emit logEntryAdded(message);
|
||||||
|
|
||||||
std::cerr << message.toStdString() << std::endl; // Print to stdout
|
std::cerr << message.toStdString() << std::endl; // Print to stdout
|
||||||
|
|
||||||
if (logToFileEnabled)
|
if (logToFileEnabled)
|
||||||
fileStream << message << endl; // Print to fileStream
|
fileStream << message << endl; // Print to fileStream
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in a new issue