Cockatrice/cockatrice/src/interface/logger.h
tooomm 94b64b8775 Be more precise about arch the build is for
Correct and simplify according to docs:
https://doc.qt.io/qt-6/qtprocessordetection.html

We only build for 64-bit cpu's
2026-07-09 15:33:12 +02:00

70 lines
1.4 KiB
C++

/**
* @file logger.h
* @ingroup Core
*/
//! \todo Document this file.
#ifndef LOGGER_H
#define LOGGER_H
#include <QFile>
#include <QMutex>
#include <QString>
#include <QTextStream>
#include <QVector>
#if defined(Q_PROCESSOR_X86)
#define BUILD_ARCHITECTURE "x64"
#elif defined(Q_PROCESSOR_ARM)
#define BUILD_ARCHITECTURE "arm64"
#else
#define BUILD_ARCHITECTURE "unknown"
#endif
class Logger : public QObject
{
Q_OBJECT
public:
static Logger &getInstance()
{
static Logger instance;
return instance;
}
void logToFile(bool enabled);
void log(QtMsgType type, const QMessageLogContext &ctx, const QString &message);
QString getClientVersion();
QString getClientOperatingSystem();
QString getSystemArchitecture();
QString getSystemLocale();
QString getClientInstallInfo();
QList<QString> getLogBuffer()
{
return logBuffer;
}
private:
Logger();
~Logger() override;
// Singleton - Don't implement copy constructor and assign operator
Logger(Logger const &);
void operator=(Logger const &);
bool logToFileEnabled;
QTextStream fileStream;
QFile fileHandle;
QList<QString> logBuffer;
QMutex mutex;
protected:
void openLogfileSession();
void closeLogfileSession();
protected slots:
void internalLog(const QString &message);
signals:
void logEntryAdded(const QString &message);
};
#endif