Log all Qt messages as usual in debug builds.

This commit is contained in:
John Preston 2021-08-17 12:25:13 +03:00
parent 1209b2692a
commit 52b9a1fceb
1 changed files with 11 additions and 2 deletions

View File

@ -424,13 +424,22 @@ void Launcher::initQtMessageLogging() {
QtMsgType type,
const QMessageLogContext &context,
const QString &msg) {
const auto InvokeOriginal = [&] {
#ifndef _DEBUG
if (Logs::DebugEnabled()) {
return;
}
#endif // _DEBUG
if (OriginalMessageHandler) {
OriginalMessageHandler(type, context, msg);
}
};
InvokeOriginal();
if (Logs::DebugEnabled() || !Logs::started()) {
if (!Logs::WritingEntry()) {
// Sometimes Qt logs something inside our own logging.
LOG((msg));
}
} else if (OriginalMessageHandler) {
OriginalMessageHandler(type, context, msg);
}
});
}