## Related Ticket(s) - Fixes #3558 
This commit is contained in:
parent
46b34d6515
commit
6e3fd30fcb
2 changed files with 20 additions and 6 deletions
|
@ -1,5 +1,7 @@
|
|||
#include "logger.h"
|
||||
#include "version_string.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDateTime>
|
||||
#include <QLocale>
|
||||
#include <QSysInfo>
|
||||
|
@ -13,9 +15,12 @@ Logger::Logger() : logToFileEnabled(false)
|
|||
logBuffer.append(getClientVersion());
|
||||
logBuffer.append(getSystemArchitecture());
|
||||
logBuffer.append(getSystemLocale());
|
||||
logBuffer.append(getClientInstallInfo());
|
||||
logBuffer.append(QString("-").repeated(75));
|
||||
std::cerr << getClientVersion().toStdString() << std::endl;
|
||||
std::cerr << getSystemArchitecture().toStdString() << std::endl;
|
||||
std::cerr << getSystemLocale().toStdString() << std::endl;
|
||||
std::cerr << getClientInstallInfo().toStdString() << std::endl;
|
||||
}
|
||||
|
||||
Logger::~Logger()
|
||||
|
@ -50,6 +55,7 @@ void Logger::openLogfileSession()
|
|||
fileStream << "Log session started at " << QDateTime::currentDateTime().toString() << endl;
|
||||
fileStream << getClientVersion() << endl;
|
||||
fileStream << getSystemArchitecture() << endl;
|
||||
fileStream << getClientInstallInfo() << endl;
|
||||
logToFileEnabled = true;
|
||||
}
|
||||
|
||||
|
@ -68,7 +74,7 @@ void Logger::log(QtMsgType /* type */, const QMessageLogContext & /* ctx */, con
|
|||
QMetaObject::invokeMethod(this, "internalLog", Qt::QueuedConnection, Q_ARG(const QString &, message));
|
||||
}
|
||||
|
||||
void Logger::internalLog(const QString message)
|
||||
void Logger::internalLog(QString message)
|
||||
{
|
||||
QMutexLocker locker(&mutex);
|
||||
|
||||
|
@ -106,7 +112,14 @@ QString Logger::getClientOperatingSystem()
|
|||
|
||||
QString Logger::getSystemLocale()
|
||||
{
|
||||
QString result;
|
||||
result.append(QString("System Locale: ") + QLocale().name());
|
||||
QString result(QString("System Locale: ") + QLocale().name());
|
||||
return result;
|
||||
}
|
||||
|
||||
QString Logger::getClientInstallInfo()
|
||||
{
|
||||
// don't rely on settingsCache->getIsPortableBuild() since the logger is initialized earlier
|
||||
bool isPortable = QFile::exists(qApp->applicationDirPath() + "/portable.dat");
|
||||
QString result(QString("Install Mode: ") + (isPortable ? "Portable" : "Standard"));
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -28,11 +28,12 @@ public:
|
|||
}
|
||||
|
||||
void logToFile(bool enabled);
|
||||
void log(QtMsgType type, const QMessageLogContext &ctx, const QString message);
|
||||
void log(QtMsgType type, const QMessageLogContext &ctx, QString message);
|
||||
QString getClientVersion();
|
||||
QString getClientOperatingSystem();
|
||||
QString getSystemArchitecture();
|
||||
QString getSystemLocale();
|
||||
QString getClientInstallInfo();
|
||||
QList<QString> getLogBuffer()
|
||||
{
|
||||
return logBuffer;
|
||||
|
@ -40,7 +41,7 @@ public:
|
|||
|
||||
private:
|
||||
Logger();
|
||||
~Logger();
|
||||
~Logger() override;
|
||||
// Singleton - Don't implement copy constructor and assign operator
|
||||
Logger(Logger const &);
|
||||
void operator=(Logger const &);
|
||||
|
@ -56,7 +57,7 @@ protected:
|
|||
void closeLogfileSession();
|
||||
|
||||
protected slots:
|
||||
void internalLog(const QString message);
|
||||
void internalLog(QString message);
|
||||
|
||||
signals:
|
||||
void logEntryAdded(QString message);
|
||||
|
|
Loading…
Reference in a new issue