forked from treefrogframework/treefrog-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtabstractlogstream.h
45 lines (34 loc) · 958 Bytes
/
tabstractlogstream.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef TABSTRACTLOGSTREAM_H
#define TABSTRACTLOGSTREAM_H
#include <QObject>
#include <QList>
#include <TLog>
class TLogger;
class TAbstractLogStream : public QObject
{
Q_OBJECT
public:
TAbstractLogStream(const QList<TLogger *> &loggers, QObject *parent);
virtual ~TAbstractLogStream() { }
virtual void writeLog(const TLog &log) = 0;
virtual void flush() = 0;
bool isNonBufferingMode() const { return nonBuffering; }
public slots:
virtual void setNonBufferingMode();
protected:
enum LoggerType {
All = 0,
MultiProcessSafe,
MultiProcessUnsafe,
};
bool loggerOpen(LoggerType type = All);
void loggerClose(LoggerType type = All);
void loggerWrite(const TLog &log);
void loggerWrite(const QList<TLog> &logs);
void loggerFlush();
private:
QList<TLogger *> loggerList;
bool nonBuffering;
Q_DISABLE_COPY(TAbstractLogStream)
};
#endif // TABSTRACTLOGSTREAM_H