QtCanpool 3.3.0
载入中...
搜索中...
未找到
qxlogger.h
浏览该文件的文档.
1
5#ifndef QXLOGGER_H
6#define QXLOGGER_H
7
8#include "qxcore_global.h"
9
10#include <QtCore/QLoggingCategory>
11#include <QtCore/QString>
12
14
26{
27public:
29 enum Level {
30 Debug = 0,
35 };
36
37 struct Options {
39 : level(Debug)
40 , maxFileSize(4 * 1024 * 1024)
41 , maxBackups(3)
42 , toConsole(true)
43 {
44 }
45
47 QString fileName;
56 };
57
63 static bool init(const Options &options = Options());
65 static void shutdown();
66 static bool isEnabled();
68 static QString fileName();
70 static void flush();
71
73 static void write(Level level, const QString &category, const QString &message);
75 static void write(Level level, const QLoggingCategory &category, const QString &message);
76private:
77 Q_DISABLE_COPY(QxLogger)
78 QxLogger() = delete;
79};
80
82
83#endif // QXLOGGER_H
Application logging built on top of Qt's message handler: the usual qDebug()/qInfo()/qWarning()/qCrit...
Definition qxlogger.h:26
Level
Level letters used in the output, in ascending severity.
Definition qxlogger.h:29
#define QX_CORE_EXPORT
#define QX_CORE_BEGIN_NAMESPACE
#define QX_CORE_END_NAMESPACE
QxLogger::Options options
Definition qxlogger.cpp:24
const char * fileName
Definition qxtheme.cpp:26
qint64 maxFileSize
Rotate once the file grows past this many bytes; <= 0 disables rotation.
Definition qxlogger.h:51
QString fileName
Log file path; empty disables file output.
Definition qxlogger.h:47
int maxBackups
Number of rotated files kept, named after the log file with a numeric suffix.
Definition qxlogger.h:53
Level level
Messages below this level are dropped.
Definition qxlogger.h:49
bool toConsole
Also write to stderr, which is what development builds want.
Definition qxlogger.h:55