QLogger
Loading...
Searching...
No Matches
qloggerfactory.h
1#ifndef QLOGGER_QLOGGERFACTORY_H
2#define QLOGGER_QLOGGERFACTORY_H
3
4#include "qloggerglobal.h"
5#include "base/baselogger.h"
6#include "log/logformatter.h"
7
8#include <memory>
9
10#include <QFileInfo>
11#include <QMutex>
12#include <QVersionNumber>
13
14namespace QLogger
15{
16
17class QLOGGER_EXPORT QLoggerFactory final
18{
19 QLOGGER_DISABLE_COPY_MOVE(QLoggerFactory)
20
21private:
22 typedef std::unique_ptr<BaseLogger> LoggerPtr;
23
24public:
25 void initLoggerDaily(const QFileInfo &file, const QTime &time, uint maxFiles, bool enableConsole);
26 void initLoggerRotating(const QFileInfo &file, int maxFiles, qint64 maxSize, bool enableConsole);
27 void desinit();
28
29public:
30 void setLevel(QtMsgType idType);
31
32public:
33 static QLoggerFactory& instance();
34 static const QVersionNumber& getLibraryVersion();
35
36private:
37 void initGeneric();
38 void proceedMessage(QtMsgType idType, const QMessageLogContext &context, const QString &msg);
39
40private:
42
43private:
44 static void messageHandler(QtMsgType idType, const QMessageLogContext &context, const QString &msg);
45
46private:
47 LoggerPtr m_logger;
48 QMutex m_mutex;
49};
50
51} // namespace QLogger
52
53#endif // QLOGGER_QLOGGERFACTORY_H
Use to manage logs.
Definition qloggerfactory.h:18