GH-1665 diagnostic build - check if log file has been created and opened
This commit is contained in:
parent
cee53f7f3c
commit
2597bde4f9
@ -429,8 +429,11 @@ void appDebugOutput(QtMsgType type, const QMessageLogContext &context, const QSt
|
||||
|
||||
QString out = format.arg(buf).arg(levels[type]).arg(msg);
|
||||
|
||||
MMC->logFile->write(out.toUtf8());
|
||||
MMC->logFile->flush();
|
||||
if(MMC->logFile && MMC->logFile->isOpen())
|
||||
{
|
||||
MMC->logFile->write(out.toUtf8());
|
||||
MMC->logFile->flush();
|
||||
}
|
||||
QTextStream(stderr) << out.toLocal8Bit();
|
||||
fflush(stderr);
|
||||
}
|
||||
@ -448,6 +451,11 @@ void MultiMC::initLogger()
|
||||
|
||||
logFile = std::make_shared<QFile>(logBase.arg(0));
|
||||
logFile->open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate);
|
||||
if(!logFile || !logFile->isOpen())
|
||||
{
|
||||
QTextStream(stderr) << "Couldn't open log file for writing: " << logBase.arg(0).toLocal8Bit();
|
||||
fflush(stderr);
|
||||
}
|
||||
}
|
||||
|
||||
void MultiMC::initGlobalSettings(bool test_mode)
|
||||
|
Loading…
Reference in New Issue
Block a user