XX CMake Package
Loading...
Searching...
No Matches
XXLogger.h
Go to the documentation of this file.
1#ifndef XXLoggerH
2#define XXLoggerH
3
4#include "XXLogExportDef.h"
5
6#include <QColor>
7#include <QDateTime>
8#include <QTextStream>
9
10namespace XX
11{
14
15 namespace Logger
16 {
17 XXLOG_DECLSPEC QTextStream stream(const Qt::GlobalColor& color = Qt::black);
18
20 {
21 public:
22 class StreamProxy;
23
24 public:
25 Target(int stackSize);
27
28 protected:
29 struct Entry
30 {
31 QDateTime timeStamp;
32 QString text;
33 QColor color;
34
35 using Buffer = QList<Entry>;
36 };
37
38 protected:
39 virtual void update(const Entry::Buffer& buffer) = 0;
40 void clear();
41
42 private:
43 void print(const QString& text, const QColor& color);
44
45 private:
46 static Target* master;
47 QList<Target*> others;
48 int stackSize;
49 Entry::Buffer buffer;
50 };
51 } // namespace Logger
52} // namespace XX
53
54#endif // NOT XXLoggerH
#define XXLOG_DECLSPEC
Definition XXLogExportDef.h:11
Target(int stackSize)
virtual void update(const Entry::Buffer &buffer)=0
provide streams for logging
Definition XXLogger.h:16
QTextStream stream(const Qt::GlobalColor &color=Qt::black)
Definition XXPopulatedAbstract.h:11
Definition XXLogger.h:30
QDateTime timeStamp
Definition XXLogger.h:31
QString text
Definition XXLogger.h:32
QColor color
Definition XXLogger.h:33
QList< Entry > Buffer
Definition XXLogger.h:35