-
Notifications
You must be signed in to change notification settings - Fork 0
/
debug_log.h
74 lines (66 loc) · 2.05 KB
/
debug_log.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#ifndef DEBUG_H
#define DEBUG_H
#include <stdio.h>
#include <stdlib.h>
#include <QtDebug>
#include <QDebug>
#include <QFile>
#include <QTextStream>
#include <QDateTime>
/*
#if _MSC_VER < 1400 // 版本较低时,不支持...类型的宏,屏蔽代码LogPrintf (vc60, vc70)
#define LogPrintf //
#else // 1400之后的版本支持...类型的宏,此时来区分_Debug和_Release模式
#ifdef _DEBUG
#define DLOG(msg)\
{\
qDebug() << msg;\
}
#define DLOG_QT_WALLET(msg, value)\
{\
qDebug() << msg << value;\
}
#define WLOG_QT_WALLET(msg, ...)\
{\
qWarning() << format << ##__VA_ARGS__;\
}
#define DLOG_QT_WALLET_FUNCTION_BEGIN \
{\
qDebug("Function:%s Begin", __FUNCTION__);\
}
#define DLOG_QT_WALLET_FUNCTION_END \
{\
qDebug("Function:%s End",__FUNCTION__);\
}
#else
#define DLOG_QT_WALLET //
#define DLOG_QT_WALLET_FUNCTION_BEGIN //
#define DLOG_QT_WALLET_FUNCTION_END //
#endif
#endif
*/
//#define RELEASE1
#if _MSC_VER < 1400 // 版本较低时,不支持...类型的宏,屏蔽代码LogPrintf (vc60, vc70)
#define LogPrintf //
#else // 1400之后的版本支持...类型的宏,此时来区分_Debug和_Release模式
#ifdef RELEASE1
#define DLOG_QT_WALLET(format, ...)\
{\
qDebug("File:%s, Line:%d, Function:%s " format, __FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__);\
}
#define DLOG_QT_WALLET_FUNCTION_BEGIN \
{\
qDebug("File:%s, Line:%d, Function:%s Begin", __FILE__, __LINE__, __FUNCTION__);\
}
#define DLOG_QT_WALLET_FUNCTION_END \
{\
qDebug("File:%s, Line:%d, Function:%s End", __FILE__, __LINE__, __FUNCTION__);\
}
#else
#define DLOG_QT_WALLET //
#define DLOG_QT_WALLET_FUNCTION_BEGIN //
#define DLOG_QT_WALLET_FUNCTION_END //
#endif
#endif
void outputMessage(QtMsgType type, const QMessageLogContext &context, const QString &msg);
#endif // DEBUG_H