Skip to content

Commit

Permalink
[TD-410] fix log print error
Browse files Browse the repository at this point in the history
  • Loading branch information
guanshengliang committed May 25, 2020
1 parent 5ab5dce commit 374751d
Show file tree
Hide file tree
Showing 11 changed files with 66 additions and 162 deletions.
23 changes: 5 additions & 18 deletions src/client/inc/tscLog.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,11 @@ extern "C" {

extern int32_t cDebugFlag;

#define tscError(...) \
if (cDebugFlag & DEBUG_ERROR) { \
taosPrintLog("ERROR TSC ", 255, __VA_ARGS__); \
}
#define tscWarn(...) \
if (cDebugFlag & DEBUG_WARN) { \
taosPrintLog("WARN TSC ", cDebugFlag, __VA_ARGS__); \
}
#define tscTrace(...) \
if (cDebugFlag & DEBUG_TRACE) { \
taosPrintLog("TSC ", cDebugFlag, __VA_ARGS__); \
}
#define tscPrint(...) \
{ taosPrintLog("TSC ", 255, __VA_ARGS__); }
#define tscDump(...) \
if (cDebugFlag & DEBUG_TRACE) { \
taosPrintLongString("TSC ", cDebugFlag, __VA_ARGS__); \
}
#define tscError(...) { if (cDebugFlag & DEBUG_ERROR) { taosPrintLog("ERROR TSC ", cDebugFlag, __VA_ARGS__); }}
#define tscWarn(...) { if (cDebugFlag & DEBUG_WARN) { taosPrintLog("WARN TSC ", cDebugFlag, __VA_ARGS__); }}
#define tscTrace(...) { if (cDebugFlag & DEBUG_TRACE) { taosPrintLog("TSC ", cDebugFlag, __VA_ARGS__); }}
#define tscDump(...) { if (cDebugFlag & DEBUG_TRACE) { taosPrintLongString("TSC ", cDebugFlag, __VA_ARGS__); }}
#define tscPrint(...) { taosPrintLog("TSC ", tscEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }

#ifdef __cplusplus
}
Expand Down
18 changes: 4 additions & 14 deletions src/client/src/TSDBJNIConnector.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,10 @@
#include "tlog.h"
#include "ttime.h"

#define jniError(...) \
if (jniDebugFlag & DEBUG_ERROR) { \
taosPrintLog("ERROR JNI ", jniDebugFlag, __VA_ARGS__); \
}
#define jniWarn(...) \
if (jniDebugFlag & DEBUG_WARN) { \
taosPrintLog("WARN JNI ", jniDebugFlag, __VA_ARGS__); \
}
#define jniTrace(...) \
if (jniDebugFlag & DEBUG_TRACE) { \
taosPrintLog("JNI ", jniDebugFlag, __VA_ARGS__); \
}
#define jniPrint(...) \
{ taosPrintLog("JNI ", 255, __VA_ARGS__); }
#define jniError(...) { if (jniDebugFlag & DEBUG_ERROR) { taosPrintLog("ERROR JNI ", jniDebugFlag, __VA_ARGS__); }}
#define jniWarn(...) { if (jniDebugFlag & DEBUG_WARN) { taosPrintLog("WARN JNI ", jniDebugFlag, __VA_ARGS__); }}
#define jniTrace(...) { if (jniDebugFlag & DEBUG_TRACE) { taosPrintLog("JNI ", jniDebugFlag, __VA_ARGS__); }}
#define jniPrint(...) { taosPrintLog("JNI ", tscEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }

int __init = 0;

Expand Down
34 changes: 9 additions & 25 deletions src/common/inc/tulog.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,31 +25,15 @@ extern "C" {
extern int32_t uDebugFlag;
extern int32_t tscEmbedded;

#define uError(...) \
if (uDebugFlag & DEBUG_ERROR) { \
taosPrintLog("ERROR UTL ", uDebugFlag, __VA_ARGS__); \
}
#define uWarn(...) \
if (uDebugFlag & DEBUG_WARN) { \
taosPrintLog("WARN UTL ", uDebugFlag, __VA_ARGS__); \
}
#define uTrace(...) \
if (uDebugFlag & DEBUG_TRACE) { \
taosPrintLog("UTL ", uDebugFlag, __VA_ARGS__); \
}
#define uDump(x, y) \
if (uDebugFlag & DEBUG_DUMP) { \
taosDumpData(x, y); \
}
#define uPrint(...) \
{ taosPrintLog("UTL ", tscEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }
#define uForcePrint(...) \
{ taosPrintLog("ERROR UTL ", 255, __VA_ARGS__); }

#define pError(...) \
{ taosPrintLog("ERROR APP ", 255, __VA_ARGS__); }
#define pPrint(...) \
{ taosPrintLog("APP ", 255, __VA_ARGS__); }
#define uError(...) { if (uDebugFlag & DEBUG_ERROR) { taosPrintLog("ERROR UTL ", uDebugFlag, __VA_ARGS__); }}
#define uWarn(...) { if (uDebugFlag & DEBUG_WARN) { taosPrintLog("WARN UTL ", uDebugFlag, __VA_ARGS__); }}
#define uTrace(...) { if (uDebugFlag & DEBUG_TRACE) { taosPrintLog("UTL ", uDebugFlag, __VA_ARGS__); }}
#define uDump(x, y) { if (uDebugFlag & DEBUG_DUMP) { taosDumpData(x, y); }}
#define uPrint(...) { taosPrintLog("UTL ", tscEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }
#define uForcePrint(...) { taosPrintLog("ERROR UTL ", 255, __VA_ARGS__); }

#define pError(...) { taosPrintLog("ERROR APP ", 255, __VA_ARGS__); }
#define pPrint(...) { taosPrintLog("APP ", 255, __VA_ARGS__); }

#ifdef __cplusplus
}
Expand Down
8 changes: 4 additions & 4 deletions src/cq/src/cqMain.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
#include "tcq.h"
#include "taos.h"

#define cError(...) if (cqDebugFlag & DEBUG_ERROR) {taosPrintLog("ERROR CQ ", cqDebugFlag, __VA_ARGS__);}
#define cWarn(...) if (cqDebugFlag & DEBUG_WARN) {taosPrintLog("WARN CQ ", cqDebugFlag, __VA_ARGS__);}
#define cTrace(...) if (cqDebugFlag & DEBUG_TRACE) {taosPrintLog("CQ ", cqDebugFlag, __VA_ARGS__);}
#define cPrint(...) {taosPrintLog("CQ ", 255, __VA_ARGS__);}
#define cError(...) { if (cqDebugFlag & DEBUG_ERROR) { taosPrintLog("ERROR CQ ", cqDebugFlag, __VA_ARGS__); }}
#define cWarn(...) { if (cqDebugFlag & DEBUG_WARN) { taosPrintLog("WARN CQ ", cqDebugFlag, __VA_ARGS__); }}
#define cTrace(...) { if (cqDebugFlag & DEBUG_TRACE) { taosPrintLog("CQ ", cqDebugFlag, __VA_ARGS__); }}
#define cPrint(...) { taosPrintLog("CQ ", 255, __VA_ARGS__); }

typedef struct {
int vgId;
Expand Down
8 changes: 4 additions & 4 deletions src/dnode/inc/dnodeInt.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ extern "C" {

extern int32_t dDebugFlag;

#define dError(...) if (dDebugFlag & DEBUG_ERROR) {taosPrintLog("ERROR DND ", 255, __VA_ARGS__); }
#define dWarn(...) if (dDebugFlag & DEBUG_WARN) {taosPrintLog("WARN DND ", dDebugFlag, __VA_ARGS__); }
#define dTrace(...) if (dDebugFlag & DEBUG_TRACE) {taosPrintLog("DND ", dDebugFlag, __VA_ARGS__); }
#define dPrint(...) {taosPrintLog("DND ", 255, __VA_ARGS__); }
#define dError(...) { if (dDebugFlag & DEBUG_ERROR) { taosPrintLog("ERROR DND ", 255, __VA_ARGS__); }}
#define dWarn(...) { if (dDebugFlag & DEBUG_WARN) { taosPrintLog("WARN DND ", dDebugFlag, __VA_ARGS__); }}
#define dTrace(...) { if (dDebugFlag & DEBUG_TRACE) { taosPrintLog("DND ", dDebugFlag, __VA_ARGS__); }}
#define dPrint(...) { taosPrintLog("DND ", 255, __VA_ARGS__); }

#ifdef __cplusplus
}
Expand Down
34 changes: 17 additions & 17 deletions src/mnode/inc/mgmtInt.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,23 @@ extern int32_t mDebugFlag;
extern int32_t sdbDebugFlag;

// mnode log function
#define mError(...) if (mDebugFlag & DEBUG_ERROR) { taosPrintLog("ERROR MND ", 255, __VA_ARGS__); }
#define mWarn(...) if (mDebugFlag & DEBUG_WARN) { taosPrintLog("WARN MND ", mDebugFlag, __VA_ARGS__); }
#define mTrace(...) if (mDebugFlag & DEBUG_TRACE) { taosPrintLog("MND ", mDebugFlag, __VA_ARGS__); }
#define mPrint(...) { taosPrintLog("MND ", 255, __VA_ARGS__); }

#define mLError(...) monitorSaveLog(2, __VA_ARGS__); mError(__VA_ARGS__)
#define mLWarn(...) monitorSaveLog(1, __VA_ARGS__); mWarn(__VA_ARGS__)
#define mLPrint(...) monitorSaveLog(0, __VA_ARGS__); mPrint(__VA_ARGS__)

#define sdbError(...) if (sdbDebugFlag & DEBUG_ERROR) { taosPrintLog("ERROR MND-SDB ", 255, __VA_ARGS__); }
#define sdbWarn(...) if (sdbDebugFlag & DEBUG_WARN) { taosPrintLog("WARN MND-SDB ", sdbDebugFlag, __VA_ARGS__); }
#define sdbTrace(...) if (sdbDebugFlag & DEBUG_TRACE) { taosPrintLog("MND-SDB ", sdbDebugFlag, __VA_ARGS__);}
#define sdbPrint(...) { taosPrintLog("MND-SDB ", 255, __VA_ARGS__); }

#define sdbLError(...) monitorSaveLog(2, __VA_ARGS__); sdbError(__VA_ARGS__)
#define sdbLWarn(...) monitorSaveLog(1, __VA_ARGS__); sdbWarn(__VA_ARGS__)
#define sdbLPrint(...) monitorSaveLog(0, __VA_ARGS__); sdbPrint(__VA_ARGS__)
#define mError(...) { if (mDebugFlag & DEBUG_ERROR) { taosPrintLog("ERROR MND ", 255, __VA_ARGS__); }}
#define mWarn(...) { if (mDebugFlag & DEBUG_WARN) { taosPrintLog("WARN MND ", mDebugFlag, __VA_ARGS__); }}
#define mTrace(...) { if (mDebugFlag & DEBUG_TRACE) { taosPrintLog("MND ", mDebugFlag, __VA_ARGS__); }}
#define mPrint(...) { taosPrintLog("MND ", 255, __VA_ARGS__); }

#define mLError(...) { monitorSaveLog(2, __VA_ARGS__); mError(__VA_ARGS__) }
#define mLWarn(...) { monitorSaveLog(1, __VA_ARGS__); mWarn(__VA_ARGS__) }
#define mLPrint(...) { monitorSaveLog(0, __VA_ARGS__); mPrint(__VA_ARGS__) }

#define sdbError(...) { if (sdbDebugFlag & DEBUG_ERROR) { taosPrintLog("ERROR MND-SDB ", 255, __VA_ARGS__); }}
#define sdbWarn(...) { if (sdbDebugFlag & DEBUG_WARN) { taosPrintLog("WARN MND-SDB ", sdbDebugFlag, __VA_ARGS__); }}
#define sdbTrace(...) { if (sdbDebugFlag & DEBUG_TRACE) { taosPrintLog("MND-SDB ", sdbDebugFlag, __VA_ARGS__);}}
#define sdbPrint(...) { taosPrintLog("MND-SDB ", 255, __VA_ARGS__); }

#define sdbLError(...) { monitorSaveLog(2, __VA_ARGS__); sdbError(__VA_ARGS__) }
#define sdbLWarn(...) { monitorSaveLog(1, __VA_ARGS__); sdbWarn(__VA_ARGS__) }
#define sdbLPrint(...) { monitorSaveLog(0, __VA_ARGS__); sdbPrint(__VA_ARGS__) }

#ifdef __cplusplus
}
Expand Down
23 changes: 5 additions & 18 deletions src/plugins/http/inc/httpLog.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,10 @@

extern int32_t httpDebugFlag;

#define httpError(...) \
if (httpDebugFlag & DEBUG_ERROR) { \
taosPrintLog("ERROR HTP ", 255, __VA_ARGS__); \
}
#define httpWarn(...) \
if (httpDebugFlag & DEBUG_WARN) { \
taosPrintLog("WARN HTP ", httpDebugFlag, __VA_ARGS__); \
}
#define httpTrace(...) \
if (httpDebugFlag & DEBUG_TRACE) { \
taosPrintLog("HTP ", httpDebugFlag, __VA_ARGS__); \
}
#define httpDump(...) \
if (httpDebugFlag & DEBUG_TRACE) { \
taosPrintLongString("HTP ", httpDebugFlag, __VA_ARGS__); \
}
#define httpPrint(...) \
{ taosPrintLog("HTP ", 255, __VA_ARGS__); }
#define httpError(...) { if (httpDebugFlag & DEBUG_ERROR) { taosPrintLog("ERROR HTP ", 255, __VA_ARGS__); }}
#define httpWarn(...) { if (httpDebugFlag & DEBUG_WARN) { taosPrintLog("WARN HTP ", httpDebugFlag, __VA_ARGS__); }}
#define httpTrace(...) { if (httpDebugFlag & DEBUG_TRACE) { taosPrintLog("HTP ", httpDebugFlag, __VA_ARGS__); }}
#define httpDump(...) { if (httpDebugFlag & DEBUG_TRACE) { taosPrintLongString("HTP ", httpDebugFlag, __VA_ARGS__); }}
#define httpPrint(...) { taosPrintLog("HTP ", 255, __VA_ARGS__); }

#endif
18 changes: 4 additions & 14 deletions src/plugins/monitor/src/monitorMain.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,10 @@
#include "dnode.h"
#include "monitor.h"

#define monitorError(...) \
if (monitorDebugFlag & DEBUG_ERROR) { \
taosPrintLog("ERROR MON ", 255, __VA_ARGS__); \
}
#define monitorWarn(...) \
if (monitorDebugFlag & DEBUG_WARN) { \
taosPrintLog("WARN MON ", monitorDebugFlag, __VA_ARGS__); \
}
#define monitorTrace(...) \
if (monitorDebugFlag & DEBUG_TRACE) { \
taosPrintLog("MON ", monitorDebugFlag, __VA_ARGS__); \
}
#define monitorPrint(...) \
{ taosPrintLog("MON ", 255, __VA_ARGS__); }
#define monitorError(...) { if (monitorDebugFlag & DEBUG_ERROR) { taosPrintLog("ERROR MON ", 255, __VA_ARGS__); }}
#define monitorWarn(...) { if (monitorDebugFlag & DEBUG_WARN) { taosPrintLog("WARN MON ", monitorDebugFlag, __VA_ARGS__); }}
#define monitorTrace(...) { if (monitorDebugFlag & DEBUG_TRACE) { taosPrintLog("MON ", monitorDebugFlag, __VA_ARGS__); }}
#define monitorPrint(...) { taosPrintLog("MON ", 255, __VA_ARGS__); }

#define SQL_LENGTH 1024
#define LOG_LEN_STR 100
Expand Down
19 changes: 4 additions & 15 deletions src/query/inc/queryLog.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,12 @@ extern "C" {

extern int32_t qDebugFlag;

#define qTrace(...) \
if (qDebugFlag & DEBUG_TRACE) { \
taosPrintLog("QRY ", qDebugFlag, __VA_ARGS__); \
}

#define qError(...) \
if (qDebugFlag & DEBUG_ERROR) { \
taosPrintLog("ERROR QRY ", qDebugFlag, __VA_ARGS__); \
}

#define qWarn(...) \
if (qDebugFlag & DEBUG_WARN) { \
taosPrintLog("WARN QRY ", qDebugFlag, __VA_ARGS__); \
}
#define qTrace(...) { if (qDebugFlag & DEBUG_TRACE) { taosPrintLog("QRY ", qDebugFlag, __VA_ARGS__); }}
#define qError(...) { if (qDebugFlag & DEBUG_ERROR) { taosPrintLog("ERROR QRY ", qDebugFlag, __VA_ARGS__); }}
#define qWarn(...) { if (qDebugFlag & DEBUG_WARN) { taosPrintLog("WARN QRY ", qDebugFlag, __VA_ARGS__); }}

#ifdef __cplusplus
}
#endif

#endif // TDENGINE_QUERY_CACHE_H
#endif // TDENGINE_QUERY_LOG_H
25 changes: 6 additions & 19 deletions src/rpc/inc/rpcLog.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,14 @@ extern "C" {

extern int32_t rpcDebugFlag;

#define tError(...) \
if (rpcDebugFlag & DEBUG_ERROR) { \
taosPrintLog("ERROR RPC ", rpcDebugFlag, __VA_ARGS__); \
}
#define tWarn(...) \
if (rpcDebugFlag & DEBUG_WARN) { \
taosPrintLog("WARN RPC ", rpcDebugFlag, __VA_ARGS__); \
}
#define tTrace(...) \
if (rpcDebugFlag & DEBUG_TRACE) { \
taosPrintLog("RPC ", rpcDebugFlag, __VA_ARGS__); \
}
#define tPrint(...) \
{ taosPrintLog("RPC ", 255, __VA_ARGS__); }
#define tDump(x, y) \
if (rpcDebugFlag & DEBUG_DUMP) { \
taosDumpData((unsigned char *)x, y); \
}
#define tError(...) { if (rpcDebugFlag & DEBUG_ERROR) { taosPrintLog("ERROR RPC ", rpcDebugFlag, __VA_ARGS__); }}
#define tWarn(...) { if (rpcDebugFlag & DEBUG_WARN) { taosPrintLog("WARN RPC ", rpcDebugFlag, __VA_ARGS__); }}
#define tTrace(...) { if (rpcDebugFlag & DEBUG_TRACE) { taosPrintLog("RPC ", rpcDebugFlag, __VA_ARGS__); }}
#define tDump(x, y) { if (rpcDebugFlag & DEBUG_DUMP) { taosDumpData((unsigned char *)x, y); }}
#define tPrint(...) { taosPrintLog("RPC ", 255, __VA_ARGS__); }

#ifdef __cplusplus
}
#endif

#endif // TDENGINE_RPC_CACHE_H
#endif // TDENGINE_RPC_LOG_H
18 changes: 4 additions & 14 deletions src/tsdb/inc/tsdbMain.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,10 @@ extern "C" {

extern int tsdbDebugFlag;

#define tsdbError(...) \
if (tsdbDebugFlag & DEBUG_ERROR) { \
taosPrintLog("ERROR TDB ", tsdbDebugFlag, __VA_ARGS__); \
}
#define tsdbWarn(...) \
if (tsdbDebugFlag & DEBUG_WARN) { \
taosPrintLog("WARN TDB ", tsdbDebugFlag, __VA_ARGS__); \
}
#define tsdbTrace(...) \
if (tsdbDebugFlag & DEBUG_TRACE) { \
taosPrintLog("TDB ", tsdbDebugFlag, __VA_ARGS__); \
}
#define tsdbPrint(...) \
{ taosPrintLog("TDB ", 255, __VA_ARGS__); }
#define tsdbError(...) { if (tsdbDebugFlag & DEBUG_ERROR) { taosPrintLog("ERROR TDB ", tsdbDebugFlag, __VA_ARGS__); }}
#define tsdbWarn(...) { if (tsdbDebugFlag & DEBUG_WARN) { taosPrintLog("WARN TDB ", tsdbDebugFlag, __VA_ARGS__); }}
#define tsdbTrace(...) { if (tsdbDebugFlag & DEBUG_TRACE) { taosPrintLog("TDB ", tsdbDebugFlag, __VA_ARGS__); }}
#define tsdbPrint(...) { taosPrintLog("TDB ", 255, __VA_ARGS__); }

// ------------------------------ TSDB META FILE INTERFACES ------------------------------
#define TSDB_META_FILE_NAME "meta"
Expand Down

0 comments on commit 374751d

Please sign in to comment.