C++SDK  1.0.0
debug.h
浏览该文件的文档.
1 #ifndef RTDEBUG_H
2 #define RTDEBUG_H
3 
4 #define RT_LOG_MODULE_TRACE
5 //#define RT_DISABLE_TRACE
6 
7 #ifndef RT_DISABLE_TRACE
8 #include "avdbase/RtLogger.h"
9 //
10 // Parameters Descriptions:
11 // [module] module number, uint32 type;
12 // [desc ] module description that will be displayed in log output to tell which module
13 // it belong to, const char* type, must be less than 64 bytes in length;
14 // [str ] log content, const char* type;
15 //
16 //#define RT_LOG_REGISTER_MODULE(module, desc) //RtLog::RegisterModule(module, desc)
17 
18 #define RT_ERROR_LOG(module, str) RT_LOG(rtcbase::LS_ERROR, module, str)
19 #define RT_WARNING_LOG(module, str) RT_LOG(rtcbase::LS_WARNING, module, str)
20 #define RT_INFO_LOG(module, str) RT_LOG(rtcbase::LS_INFO, module, str)
21 #ifdef _DEBUG
22 #define RT_STATE_LOG(module, str) RT_LOG(rtcbase::LS_VERBOSE, module, str)
23 #else
24 #define RT_STATE_LOG(module, str) RT_LOG(rtcbase::LS_VERBOSE, module, str)
25 #endif
26 
27 
28 #define RT_ERROR_LOG_THIS(module, str) RT_LOG(rtcbase::LS_ERROR, module, str << " this=" << this)
29 #define RT_WARNING_LOG_THIS(module, str) RT_LOG(rtcbase::LS_WARNING, module, str << " this=" << this)
30 #define RT_INFO_LOG_THIS(module, str) RT_LOG(rtcbase::LS_INFO, module, str << " this=" << this)
31 #define RT_STATE_LOG_THIS(module, str) RT_LOG(rtcbase::LS_VERBOSE, module, str << " this=" << this)
32 
34 #define UPLOAD_LOG_DEBUG 1
35 #define UPLOAD_LOG_INFO 2
36 #define UPLOAD_LOG_ERROR 3
37 
38 #define LOG_INFO_UPLOG_END(room,level) \
39  {std::string str = log_os.str(); if (room){ room->createLogPduMsg(str, level); } }
40 
41 #define LOG_DEBUG_UPLOG(str,room) \
42  {LOG_STATE_T_F(str); std::ostringstream log_os; log_os << __FUNCTION__ << ":" << str; LOG_INFO_UPLOG_END(room, UPLOAD_LOG_DEBUG); }
43 #define LOG_INFO_UPLOG(str,room) \
44  {LOG_INFO_T_F(str); std::ostringstream log_os; log_os << __FUNCTION__ << ":" << str; LOG_INFO_UPLOG_END(room, UPLOAD_LOG_INFO); }
45 #define LOG_ERROR_UPLOG(str,room) \
46  {LOG_ERROR_T_F(str); std::ostringstream log_os; log_os << __FUNCTION__ << ":" << str; LOG_INFO_UPLOG_END(room, UPLOAD_LOG_ERROR); }
47 
49 /*-----------------------------------------------------------------------------------*/
50 
51 #define LOG_ERROR(str) RT_ERROR_LOG(RT_LOG_MODULE_TRACE, str)
52 #define LOG_WARNING(str) RT_WARNING_LOG(RT_LOG_MODULE_TRACE, str)
53 #define LOG_INFO(str) RT_INFO_LOG(RT_LOG_MODULE_TRACE, str)
54 #define LOG_STATE(str) RT_STATE_LOG(RT_LOG_MODULE_TRACE, str)
55 
56 #define LOG_ERROR_T(str) LOG_ERROR(str << " this=" << this)
57 #define LOG_WARNING_T(str) LOG_WARNING(str << " this=" << this)
58 #define LOG_INFO_T(str) LOG_INFO(str << " this=" << this)
59 #define LOG_STATE_T(str) LOG_STATE(str << " this=" << this)
60 
61 #define LOG_ERROR_F(str) LOG_ERROR(__FUNCTION__ << ": " << str)
62 #define LOG_WARNING_F(str) LOG_WARNING(__FUNCTION__ << ": " << str)
63 #define LOG_INFO_F(str) LOG_INFO(__FUNCTION__ << ": " << str)
64 #define LOG_STATE_F(str) LOG_STATE(__FUNCTION__ << ": " << str)
65 
66 #define LOG_ERROR_T_F(str) LOG_ERROR(__FUNCTION__ << ": " << str << " this=" << this)
67 #define LOG_WARNING_T_F(str) LOG_WARNING(__FUNCTION__ << ": " << str << " this=" << this)
68 #define LOG_INFO_T_F(str) LOG_INFO(__FUNCTION__ << ": " << str << " this=" << this)
69 #define LOG_STATE_T_F(str) LOG_STATE(__FUNCTION__ << ": " << str << " this=" << this)
70 #else
71 
72 //#define RT_LOG_REGISTER_MODULE(module, desc)
73 
74 #define RT_ERROR_LOG(module, str)
75 #define RT_WARNING_LOG(module, str)
76 #define RT_INFO_LOG(module, str)
77 #define RT_STATE_LOG(module, str)
78 
79 #define RT_ERROR_LOG_THIS(module, str)
80 #define RT_WARNING_LOG_THIS(module, str)
81 #define RT_INFO_LOG_THIS(module, str)
82 #define RT_STATE_LOG_THIS(module, str)
83 
84 /*-----------------------------------------------------------------------------------*/
85 
86 #define LOG_ERROR(str)
87 #define LOG_WARNING(str)
88 #define LOG_INFO(str)
89 #define LOG_STATE(str)
90 #define RT_FUNC_TRACE(str)
91 
92 #define LOG_ERROR_T(str)
93 #define LOG_WARNING_T(str)
94 #define LOG_INFO_T(str)
95 #define LOG_STATE_T(str)
96 
97 #define LOG_ERROR_F(str)
98 #define LOG_WARNING_F(str)
99 #define LOG_INFO_F(str)
100 #define LOG_STATE_F(str)
101 
102 #define LOG_ERROR_T_F(str)
103 #define LOG_WARNING_T_F(str)
104 #define LOG_INFO_T_F(str)
105 #define LOG_STATE_T_F(str)
106 #endif // RT_DISABLE_TRACE
107 
108 
109 #define RT_DIAGNOSE_TRACE(str)
110 
111 #endif // RTDEBUG_H