Commit 8d3ffaaf authored by Victor Yacovlev's avatar Victor Yacovlev

Win32: Force debugging log in temporary dir

parent 7b919a21
......@@ -6,7 +6,7 @@
#include <QDateTime>
#include <QBuffer>
#include <QTextStream>
#include <QDir>
extern "C" {
#include <stdio.h>
......@@ -14,17 +14,29 @@ extern "C" {
namespace ExtensionSystem {
Logger* Logger::self_ = 0;
Logger* Logger::instance()
{
QString path;
foreach (QString arg, qApp->arguments()) {
if (arg.startsWith("--log=")) {
path = arg.mid(6);
break;
{
if (!self_) {
QString path;
foreach (QString arg, qApp->arguments()) {
if (arg.startsWith("--log=")) {
path = arg.mid(6);
break;
}
}
#if defined(Q_OS_WIN32) && defined(QT_NO_DEBUG)
if (path.isEmpty()) {
path = QDir::temp().absoluteFilePath("kumir-log.txt");
if (QFile::exists(path)) {
QFile::remove(path);
}
}
#endif
self_ = new Logger(path, qApp->arguments().contains("--debug")? Debug : Release);
}
static Logger logger = Logger(path, qApp->arguments().contains("--debug")? Debug : Release);
return &logger;
return self_;
}
Logger::Logger(const QString & filePath, LogLevel logLevel)
......
......@@ -39,6 +39,7 @@ private:
Logger(const QString & filePath, LogLevel logLevel);
QFile * loggerFile_;
LogLevel logLevel_;
static Logger * self_;
};
} // namespace ExtensionSystem
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment