mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
* 1/3 Add .clang-format file and travis compilation check * 2/3 Run clang-format * 3/3 Fix compilation problems due to include reordering * 3bis/3 AfterControlStatement: false
36 lines
695 B
C++
36 lines
695 B
C++
#ifndef SERVER_LOGGER_H
|
|
#define SERVER_LOGGER_H
|
|
|
|
#include <QMutex>
|
|
#include <QObject>
|
|
#include <QStringList>
|
|
#include <QThread>
|
|
#include <QWaitCondition>
|
|
|
|
class QFile;
|
|
class Server_ProtocolHandler;
|
|
|
|
class ServerLogger : public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
ServerLogger(bool _logToConsole, QObject *parent = 0);
|
|
~ServerLogger();
|
|
public slots:
|
|
void startLog(const QString &logFileName);
|
|
void logMessage(QString message, void *caller = 0);
|
|
void rotateLogs();
|
|
private slots:
|
|
void flushBuffer();
|
|
signals:
|
|
void sigFlushBuffer();
|
|
|
|
private:
|
|
bool logToConsole;
|
|
static QFile *logFile;
|
|
bool flushRunning;
|
|
QStringList buffer;
|
|
QMutex bufferMutex;
|
|
};
|
|
|
|
#endif
|