mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-10 00:04:48 -07:00
Fix crash on logger; make log window modalless (#2659)
This commit is contained in:
parent
9dd3a04a08
commit
ce77d51a8f
6 changed files with 39 additions and 18 deletions
|
|
@ -48,21 +48,24 @@ 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)
|
||||
{
|
||||
QMetaObject::invokeMethod(this, "internalLog", Qt::QueuedConnection,
|
||||
Q_ARG(const QString &, message)
|
||||
);
|
||||
}
|
||||
|
||||
void Logger::internalLog(const QString message)
|
||||
{
|
||||
QMutexLocker locker(&mutex);
|
||||
|
||||
logBuffer.append(message);
|
||||
if (logBuffer.size() > LOGGER_MAX_ENTRIES)
|
||||
logBuffer.clear();
|
||||
logBuffer.removeFirst();
|
||||
|
||||
if (message.size() > 0) {
|
||||
emit logEntryAdded(message);
|
||||
std::cerr << message.toStdString() << std::endl; // Print to stdout
|
||||
emit logEntryAdded(message);
|
||||
std::cerr << message.toStdString() << std::endl; // Print to stdout
|
||||
|
||||
if (logToFileEnabled)
|
||||
fileStream << message << endl; // Print to fileStream
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
if (logToFileEnabled)
|
||||
fileStream << message << endl; // Print to fileStream
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue