iVS3D v2.0.0
Loading...
Searching...
No Matches
logmanager.h
1#ifndef LOGMANAGER_H
2#define LOGMANAGER_H
3
4#include <QList>
5#include <QJsonObject>
6#include <QFile>
7#include <QDir>
8#include <QCoreApplication>
9
10#include "stringcontainer.h"
11#include "logfile.h"
12
13#define FILE_NAME_SUFFIX "_ddMMyyyy_hhmmss"
14#define FULL_FILE_PATH m_logDir + (QString)"/" + m_fileName + (QString)".json"
15
28class LogManager : public QObject
29{
30 Q_OBJECT
31
32public:
37 static LogManager& instance();
44 LogFile* createLogFile(QString name, bool isPlugin);
48 void deleteAllLogFiles();
53 QJsonDocument toJSON();
54
58 void resetLog();
64 void toggleLog(bool useLog);
71 void setLogDirectory(QString logDir);
72
73public slots:
74
79 bool slot_updateLog();
80
81private:
82 bool print();
83 LogManager();
84 QList<QPair<QString, LogFile*>> m_allLogFiles;
85 QString m_fileName;
86 QString m_logDir;
87 bool m_logEnabled = true;
88};
89
90#endif // LOGMANAGER_H
The LogFile class logs progress as well as information about a process (e.g. Inport,...
Definition logfile.h:23
The LogManager class is a singleton which manages the logging process. It provides LogFiles that are ...
Definition logmanager.h:29
static LogManager & instance()
Returns the singleton instance of this class.
Definition logmanager.cpp:11
void toggleLog(bool useLog)
toggleLog is used to enable or disable loging (-> saving the log file to disk or not)
Definition logmanager.cpp:58
void deleteAllLogFiles()
deleteAllLogFiles Deletes all LogFiles. Every existing pointer is invalid now.
Definition logmanager.cpp:26
void setLogDirectory(QString logDir)
setLogDirectory changes the directory where the log file is printed to. It wont an artifical folder i...
Definition logmanager.cpp:63
void resetLog()
resetLog resets the current log and creates a new log
Definition logmanager.cpp:52
LogFile * createLogFile(QString name, bool isPlugin)
createLogFile Returns the pointer to an already existing LogFile or creates a new one if neccessary....
Definition logmanager.cpp:17
bool slot_updateLog()
update is called whenever a logfile changes. This will print the current log files.
Definition logmanager.cpp:68
QJsonDocument toJSON()
toQJSON Returns the current state of the log files in form of a QJsonObject
Definition logmanager.cpp:38