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)
|
||||
{
|
||||
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
|
||||
|
||||
|
||||
}
|
Loading…
Reference in a new issue