aboutsummaryrefslogtreecommitdiff
path: root/Logger/logger.h
blob: 9880c447f61d0e9fac19d4b5383fec97e583bbf5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef LOGGER_H
#define LOGGER_H

#include <QDir>
#include <QFile>
#include <QDateTime>
#include <QTextStream>

#include "Settings/settingstructure.h"
#include "Core/version.h"
#include "logprimitive.h"

class Logger
{
public:
    Logger();
    bool init(const QString          &applicationPath,
              const SettingStructure &settings);
    void stop();
    void logEvent(const QString &messageType,
                  const QString &message);

private:
    // path variables
    const QString _logDirectory = "../log";
    const QString _logLabel = "MasterServer-" + SHORT_VER;
    QString _logPath = "";

    // local variables
    int _cyclePeriod;
    QString _logFileName;
    QString _suppressLog;
    QString _suppressDisplay;

    // file i/o
    QFile _logFile;

private:
    bool cycleLogFile();
    bool openLogFile();
    void closeLogFile();
    bool writeLogFile(const QString message);

};

#endif // LOGGER_H