QLogger
Loading...
Searching...
No Matches
baselogger.h
1#ifndef QLOGGER_BASELOGGER_H
2#define QLOGGER_BASELOGGER_H
3
4#include <QHash>
5#include <QObject>
6
7#include "qlogger/log/logbinary.h"
8
9namespace QLogger
10{
11
12class BaseLogger : public QObject
13{
14 Q_OBJECT
15
16public:
17 BaseLogger(bool enableConsole, QObject *parent = nullptr);
18 virtual ~BaseLogger() = default;
19
20public:
21 void setLevel(QtMsgType idType);
22 void writeLog(const LogBinary &log);
23
24public:
25 virtual void start() = 0;
26
27protected:
28 virtual void write(const LogBinary &log) = 0;
29 virtual void flush() = 0;
30
31private:
32 void printToConsole(const LogBinary &log);
33
34private:
35 int m_minPriority = 0;
36 bool m_enableConsole;
37
38private:
39 static const QHash<QtMsgType, int> MAP_LEVEL_PRIORITY;
40};
41
42} // Namespace QLogger
43
44#endif // QLOGGER_BASELOGGER_H
Definition baselogger.h:13
void setLevel(QtMsgType idType)
Use to set minimum level of log message to be managed.
Definition baselogger.cpp:70