-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLogFile.h
More file actions
41 lines (32 loc) · 811 Bytes
/
LogFile.h
File metadata and controls
41 lines (32 loc) · 811 Bytes
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
#ifndef LOGFILE_H_
#define LOGFILE_H_
#include <QMutex>
#include <QStringList>
enum LOG_LEVEL{
LOG_INFO = 0,
LOG_DEBUG,
LOG_WARN,
LOG_ERROR,
};
extern bool g_IsDebug;
class CEasyLog
{
public:
CEasyLog(/*LPCSTR lpFile = NULL*/);
virtual ~CEasyLog(void);
public:
QStringList m_recordList;
private:
QString m_strFile;
QMutex m_mutex;
public:
void writeLog(LOG_LEVEL level,QString strLog);
void clearLog();
static CEasyLog &Instance();
};
#define qLog(x) CEasyLog::Instance().writeLog(LOG_INFO,x);
#define qDbg(x) if(g_IsDebug){CEasyLog::Instance().writeLog(LOG_DEBUG,x);}
#define qWarn(x) CEasyLog::Instance().writeLog(LOG_WARN,x);
#define qError(x) CEasyLog::Instance().writeLog(LOG_ERROR,x);
#define qclearLog() CEasyLog::Instance().clearLog();
#endif