summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2016-10-27 13:14:51 +0200
committerPetr Mrázek <peterix@gmail.com>2016-10-27 13:17:19 +0200
commit2597bde4f9df5409371da55beabb0f695b853aa3 (patch)
treec94c65399e9d6ada67aed0d777693cc4356824da
parentcee53f7f3ceb120aac83dbb60683fb228b385c2e (diff)
downloadMultiMC-2597bde4f9df5409371da55beabb0f695b853aa3.tar
MultiMC-2597bde4f9df5409371da55beabb0f695b853aa3.tar.gz
MultiMC-2597bde4f9df5409371da55beabb0f695b853aa3.tar.lz
MultiMC-2597bde4f9df5409371da55beabb0f695b853aa3.tar.xz
MultiMC-2597bde4f9df5409371da55beabb0f695b853aa3.zip
GH-1665 diagnostic build - check if log file has been created and opened
-rw-r--r--application/MultiMC.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/application/MultiMC.cpp b/application/MultiMC.cpp
index a226f3b7..0911fcc2 100644
--- a/application/MultiMC.cpp
+++ b/application/MultiMC.cpp
@@ -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)