| 1 |
#ifndef LOGGER_H |
| 2 |
#define LOGGER_H |
| 3 |
#include <QFile> |
| 4 |
#include <QTextStream> |
| 5 |
#include <QMutex> |
| 6 |
#include <QDateTime> |
| 7 |
#include <memory> |
| 8 |
|
| 9 |
class Logger |
| 10 |
{ |
| 11 |
public: |
| 12 |
Logger(QString appDir, QString logFileName); |
| 13 |
~Logger(); |
| 14 |
void writeString(QString strToWrite); |
| 15 |
void writeBytes(QByteArray arrToWrite); |
| 16 |
private: |
| 17 |
std::unique_ptr<QFile> myLogFile; |
| 18 |
std::unique_ptr<QTextStream> logStream; |
| 19 |
QMutex mutex; //mutex for control writes to the logs |
| 20 |
}; |
| 21 |
|
| 22 |
#endif // LOGGER_H |