record num of logs for monitoring
This commit is contained in:
parent
51e2870cb8
commit
1d9119df87
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
#include "tarray.h"
|
#include "tarray.h"
|
||||||
#include "tdef.h"
|
#include "tdef.h"
|
||||||
|
#include "tlog.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -126,16 +127,9 @@ typedef struct {
|
||||||
SMonDiskDesc tempdir;
|
SMonDiskDesc tempdir;
|
||||||
} SMonDiskInfo;
|
} SMonDiskInfo;
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
MON_LEVEL_ERROR = 0,
|
|
||||||
MON_LEVEL_INFO = 1,
|
|
||||||
MON_LEVEL_DEBUG = 2,
|
|
||||||
MON_LEVEL_TRACE = 3,
|
|
||||||
} EMonLogLevel;
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int64_t ts;
|
int64_t ts;
|
||||||
EMonLogLevel level;
|
ELogLevel level;
|
||||||
char content[MON_LOG_LEN];
|
char content[MON_LOG_LEN];
|
||||||
} SMonLogItem;
|
} SMonLogItem;
|
||||||
|
|
||||||
|
|
|
@ -168,20 +168,18 @@ int32_t queryCreateTableMetaFromMsg(STableMetaRsp* msg, bool isSuperTable, STabl
|
||||||
extern int32_t (*queryBuildMsg[TDMT_MAX])(void* input, char **msg, int32_t msgSize, int32_t *msgLen);
|
extern int32_t (*queryBuildMsg[TDMT_MAX])(void* input, char **msg, int32_t msgSize, int32_t *msgLen);
|
||||||
extern int32_t (*queryProcessMsgRsp[TDMT_MAX])(void* output, char *msg, int32_t msgSize);
|
extern int32_t (*queryProcessMsgRsp[TDMT_MAX])(void* output, char *msg, int32_t msgSize);
|
||||||
|
|
||||||
|
|
||||||
#define SET_META_TYPE_NULL(t) (t) = META_TYPE_NULL_TABLE
|
#define SET_META_TYPE_NULL(t) (t) = META_TYPE_NULL_TABLE
|
||||||
#define SET_META_TYPE_CTABLE(t) (t) = META_TYPE_CTABLE
|
#define SET_META_TYPE_CTABLE(t) (t) = META_TYPE_CTABLE
|
||||||
#define SET_META_TYPE_TABLE(t) (t) = META_TYPE_TABLE
|
#define SET_META_TYPE_TABLE(t) (t) = META_TYPE_TABLE
|
||||||
#define SET_META_TYPE_BOTH_TABLE(t) (t) = META_TYPE_BOTH_TABLE
|
#define SET_META_TYPE_BOTH_TABLE(t) (t) = META_TYPE_BOTH_TABLE
|
||||||
|
|
||||||
#define qFatal(...) do { if (qDebugFlag & DEBUG_FATAL) { taosPrintLog("QRY FATAL ", qDebugFlag, __VA_ARGS__); }} while(0)
|
#define qFatal(...) do { if (qDebugFlag & DEBUG_FATAL) { taosPrintLog("QRY FATAL ", DEBUG_FATAL, qDebugFlag, __VA_ARGS__); }} while(0)
|
||||||
#define qError(...) do { if (qDebugFlag & DEBUG_ERROR) { taosPrintLog("QRY ERROR ", qDebugFlag, __VA_ARGS__); }} while(0)
|
#define qError(...) do { if (qDebugFlag & DEBUG_ERROR) { taosPrintLog("QRY ERROR ", DEBUG_ERROR, qDebugFlag, __VA_ARGS__); }} while(0)
|
||||||
#define qWarn(...) do { if (qDebugFlag & DEBUG_WARN) { taosPrintLog("QRY WARN ", qDebugFlag, __VA_ARGS__); }} while(0)
|
#define qWarn(...) do { if (qDebugFlag & DEBUG_WARN) { taosPrintLog("QRY WARN ", DEBUG_WARN, qDebugFlag, __VA_ARGS__); }} while(0)
|
||||||
#define qInfo(...) do { if (qDebugFlag & DEBUG_INFO) { taosPrintLog("QRY ", qDebugFlag, __VA_ARGS__); }} while(0)
|
#define qInfo(...) do { if (qDebugFlag & DEBUG_INFO) { taosPrintLog("QRY ", DEBUG_INFO, qDebugFlag, __VA_ARGS__); }} while(0)
|
||||||
#define qDebug(...) do { if (qDebugFlag & DEBUG_DEBUG) { taosPrintLog("QRY ", qDebugFlag, __VA_ARGS__); }} while(0)
|
#define qDebug(...) do { if (qDebugFlag & DEBUG_DEBUG) { taosPrintLog("QRY ", DEBUG_DEBUG, qDebugFlag, __VA_ARGS__); }} while(0)
|
||||||
#define qTrace(...) do { if (qDebugFlag & DEBUG_TRACE) { taosPrintLog("QRY ", qDebugFlag, __VA_ARGS__); }} while(0)
|
#define qTrace(...) do { if (qDebugFlag & DEBUG_TRACE) { taosPrintLog("QRY ", DEBUG_TRACE, qDebugFlag, __VA_ARGS__); }} while(0)
|
||||||
#define qDebugL(...) do { if (qDebugFlag & DEBUG_DEBUG) { taosPrintLongString("QRY ", qDebugFlag, __VA_ARGS__); }} while(0)
|
#define qDebugL(...) do { if (qDebugFlag & DEBUG_DEBUG) { taosPrintLongString("QRY ", DEBUG_DEBUG, qDebugFlag, __VA_ARGS__); }} while(0)
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,42 +24,40 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern int32_t wDebugFlag;
|
|
||||||
|
|
||||||
#define wFatal(...) \
|
#define wFatal(...) \
|
||||||
{ \
|
{ \
|
||||||
if (wDebugFlag & DEBUG_FATAL) { \
|
if (wDebugFlag & DEBUG_FATAL) { \
|
||||||
taosPrintLog("WAL FATAL ", 255, __VA_ARGS__); \
|
taosPrintLog("WAL FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#define wError(...) \
|
#define wError(...) \
|
||||||
{ \
|
{ \
|
||||||
if (wDebugFlag & DEBUG_ERROR) { \
|
if (wDebugFlag & DEBUG_ERROR) { \
|
||||||
taosPrintLog("WAL ERROR ", 255, __VA_ARGS__); \
|
taosPrintLog("WAL ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#define wWarn(...) \
|
#define wWarn(...) \
|
||||||
{ \
|
{ \
|
||||||
if (wDebugFlag & DEBUG_WARN) { \
|
if (wDebugFlag & DEBUG_WARN) { \
|
||||||
taosPrintLog("WAL WARN ", 255, __VA_ARGS__); \
|
taosPrintLog("WAL WARN ", DEBUG_WARN, 255, __VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#define wInfo(...) \
|
#define wInfo(...) \
|
||||||
{ \
|
{ \
|
||||||
if (wDebugFlag & DEBUG_INFO) { \
|
if (wDebugFlag & DEBUG_INFO) { \
|
||||||
taosPrintLog("WAL ", 255, __VA_ARGS__); \
|
taosPrintLog("WAL ", DEBUG_INFO, 255, __VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#define wDebug(...) \
|
#define wDebug(...) \
|
||||||
{ \
|
{ \
|
||||||
if (wDebugFlag & DEBUG_DEBUG) { \
|
if (wDebugFlag & DEBUG_DEBUG) { \
|
||||||
taosPrintLog("WAL ", wDebugFlag, __VA_ARGS__); \
|
taosPrintLog("WAL ", DEBUG_DEBUG, wDebugFlag, __VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#define wTrace(...) \
|
#define wTrace(...) \
|
||||||
{ \
|
{ \
|
||||||
if (wDebugFlag & DEBUG_TRACE) { \
|
if (wDebugFlag & DEBUG_TRACE) { \
|
||||||
taosPrintLog("WAL ", wDebugFlag, __VA_ARGS__); \
|
taosPrintLog("WAL ", DEBUG_TRACE, wDebugFlag, __VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,15 +22,17 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DEBUG_FATAL 1U
|
typedef enum {
|
||||||
#define DEBUG_ERROR DEBUG_FATAL
|
DEBUG_FATAL = 1,
|
||||||
#define DEBUG_WARN 2U
|
DEBUG_ERROR = 1,
|
||||||
#define DEBUG_INFO DEBUG_WARN
|
DEBUG_WARN = 2,
|
||||||
#define DEBUG_DEBUG 4U
|
DEBUG_INFO = 2,
|
||||||
#define DEBUG_TRACE 8U
|
DEBUG_DEBUG = 4,
|
||||||
#define DEBUG_DUMP 16U
|
DEBUG_TRACE = 8,
|
||||||
#define DEBUG_SCREEN 64U
|
DEBUG_DUMP = 16,
|
||||||
#define DEBUG_FILE 128U
|
DEBUG_SCREEN = 64,
|
||||||
|
DEBUG_FILE = 128
|
||||||
|
} ELogLevel;
|
||||||
|
|
||||||
extern bool tsLogEmbedded;
|
extern bool tsLogEmbedded;
|
||||||
extern bool tsAsyncLog;
|
extern bool tsAsyncLog;
|
||||||
|
@ -61,27 +63,27 @@ void taosResetLog();
|
||||||
void taosSetAllDebugFlag(int32_t flag);
|
void taosSetAllDebugFlag(int32_t flag);
|
||||||
void taosDumpData(uint8_t *msg, int32_t len);
|
void taosDumpData(uint8_t *msg, int32_t len);
|
||||||
|
|
||||||
void taosPrintLog(const char *flags, int32_t dflag, const char *format, ...)
|
void taosPrintLog(const char *flags, ELogLevel level, int32_t dflag, const char *format, ...)
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
__attribute__((format(printf, 3, 4)))
|
__attribute__((format(printf, 4, 5)))
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
|
|
||||||
void taosPrintLongString(const char *flags, int32_t dflag, const char *format, ...)
|
void taosPrintLongString(const char *flags, ELogLevel level, int32_t dflag, const char *format, ...)
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
__attribute__((format(printf, 3, 4)))
|
__attribute__((format(printf, 4, 5)))
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
|
|
||||||
#define uFatal(...) { if (uDebugFlag & DEBUG_FATAL) { taosPrintLog("UTL FATAL", tsLogEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }}
|
#define uFatal(...) { if (uDebugFlag & DEBUG_FATAL) { taosPrintLog("UTL FATAL", DEBUG_FATAL, tsLogEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }}
|
||||||
#define uError(...) { if (uDebugFlag & DEBUG_ERROR) { taosPrintLog("UTL ERROR ", tsLogEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }}
|
#define uError(...) { if (uDebugFlag & DEBUG_ERROR) { taosPrintLog("UTL ERROR ", DEBUG_ERROR, tsLogEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }}
|
||||||
#define uWarn(...) { if (uDebugFlag & DEBUG_WARN) { taosPrintLog("UTL WARN ", tsLogEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }}
|
#define uWarn(...) { if (uDebugFlag & DEBUG_WARN) { taosPrintLog("UTL WARN ", DEBUG_WARN, tsLogEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }}
|
||||||
#define uInfo(...) { if (uDebugFlag & DEBUG_INFO) { taosPrintLog("UTL ", tsLogEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }}
|
#define uInfo(...) { if (uDebugFlag & DEBUG_INFO) { taosPrintLog("UTL ", DEBUG_INFO, tsLogEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }}
|
||||||
#define uDebug(...) { if (uDebugFlag & DEBUG_DEBUG) { taosPrintLog("UTL ", uDebugFlag, __VA_ARGS__); }}
|
#define uDebug(...) { if (uDebugFlag & DEBUG_DEBUG) { taosPrintLog("UTL ", DEBUG_DEBUG, uDebugFlag, __VA_ARGS__); }}
|
||||||
#define uTrace(...) { if (uDebugFlag & DEBUG_TRACE) { taosPrintLog("UTL ", uDebugFlag, __VA_ARGS__); }}
|
#define uTrace(...) { if (uDebugFlag & DEBUG_TRACE) { taosPrintLog("UTL ", DEBUG_TRACE, uDebugFlag, __VA_ARGS__); }}
|
||||||
|
|
||||||
#define pError(...) { taosPrintLog("APP ERROR ", 255, __VA_ARGS__); }
|
#define pError(...) { taosPrintLog("APP ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }
|
||||||
#define pPrint(...) { taosPrintLog("APP ", 255, __VA_ARGS__); }
|
#define pPrint(...) { taosPrintLog("APP ", DEBUG_INFO, 255, __VA_ARGS__); }
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,13 +22,13 @@ extern "C" {
|
||||||
|
|
||||||
#include "tlog.h"
|
#include "tlog.h"
|
||||||
|
|
||||||
#define tscFatal(...) do { if (cDebugFlag & DEBUG_FATAL) { taosPrintLog("TSC FATAL ", cDebugFlag, __VA_ARGS__); }} while(0)
|
#define tscFatal(...) do { if (cDebugFlag & DEBUG_FATAL) { taosPrintLog("TSC FATAL ", DEBUG_FATAL, cDebugFlag, __VA_ARGS__); }} while(0)
|
||||||
#define tscError(...) do { if (cDebugFlag & DEBUG_ERROR) { taosPrintLog("TSC ERROR ", cDebugFlag, __VA_ARGS__); }} while(0)
|
#define tscError(...) do { if (cDebugFlag & DEBUG_ERROR) { taosPrintLog("TSC ERROR ", DEBUG_ERROR, cDebugFlag, __VA_ARGS__); }} while(0)
|
||||||
#define tscWarn(...) do { if (cDebugFlag & DEBUG_WARN) { taosPrintLog("TSC WARN ", cDebugFlag, __VA_ARGS__); }} while(0)
|
#define tscWarn(...) do { if (cDebugFlag & DEBUG_WARN) { taosPrintLog("TSC WARN ", DEBUG_WARN, cDebugFlag, __VA_ARGS__); }} while(0)
|
||||||
#define tscInfo(...) do { if (cDebugFlag & DEBUG_INFO) { taosPrintLog("TSC ", cDebugFlag, __VA_ARGS__); }} while(0)
|
#define tscInfo(...) do { if (cDebugFlag & DEBUG_INFO) { taosPrintLog("TSC ", DEBUG_INFO, cDebugFlag, __VA_ARGS__); }} while(0)
|
||||||
#define tscDebug(...) do { if (cDebugFlag & DEBUG_DEBUG) { taosPrintLog("TSC ", cDebugFlag, __VA_ARGS__); }} while(0)
|
#define tscDebug(...) do { if (cDebugFlag & DEBUG_DEBUG) { taosPrintLog("TSC ", DEBUG_DEBUG, cDebugFlag, __VA_ARGS__); }} while(0)
|
||||||
#define tscTrace(...) do { if (cDebugFlag & DEBUG_TRACE) { taosPrintLog("TSC ", cDebugFlag, __VA_ARGS__); }} while(0)
|
#define tscTrace(...) do { if (cDebugFlag & DEBUG_TRACE) { taosPrintLog("TSC ", DEBUG_TRACE, cDebugFlag, __VA_ARGS__); }} while(0)
|
||||||
#define tscDebugL(...) do { if (cDebugFlag & DEBUG_DEBUG) { taosPrintLongString("TSC ", cDebugFlag, __VA_ARGS__); }} while(0)
|
#define tscDebugL(...) do { if (cDebugFlag & DEBUG_DEBUG) { taosPrintLongString("TSC ", DEBUG_DEBUG, cDebugFlag, __VA_ARGS__); }} while(0)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,14 +47,12 @@ extern "C" {
|
||||||
#include "vnode.h"
|
#include "vnode.h"
|
||||||
#include "tfs.h"
|
#include "tfs.h"
|
||||||
|
|
||||||
extern int32_t dDebugFlag;
|
#define dFatal(...) { if (dDebugFlag & DEBUG_FATAL) { taosPrintLog("DND FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }}
|
||||||
|
#define dError(...) { if (dDebugFlag & DEBUG_ERROR) { taosPrintLog("DND ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }}
|
||||||
#define dFatal(...) { if (dDebugFlag & DEBUG_FATAL) { taosPrintLog("DND FATAL ", 255, __VA_ARGS__); }}
|
#define dWarn(...) { if (dDebugFlag & DEBUG_WARN) { taosPrintLog("DND WARN ", DEBUG_WARN, 255, __VA_ARGS__); }}
|
||||||
#define dError(...) { if (dDebugFlag & DEBUG_ERROR) { taosPrintLog("DND ERROR ", 255, __VA_ARGS__); }}
|
#define dInfo(...) { if (dDebugFlag & DEBUG_INFO) { taosPrintLog("DND ", DEBUG_INFO, 255, __VA_ARGS__); }}
|
||||||
#define dWarn(...) { if (dDebugFlag & DEBUG_WARN) { taosPrintLog("DND WARN ", 255, __VA_ARGS__); }}
|
#define dDebug(...) { if (dDebugFlag & DEBUG_DEBUG) { taosPrintLog("DND ", DEBUG_DEBUG, dDebugFlag, __VA_ARGS__); }}
|
||||||
#define dInfo(...) { if (dDebugFlag & DEBUG_INFO) { taosPrintLog("DND ", 255, __VA_ARGS__); }}
|
#define dTrace(...) { if (dDebugFlag & DEBUG_TRACE) { taosPrintLog("DND ", DEBUG_TRACE, dDebugFlag, __VA_ARGS__); }}
|
||||||
#define dDebug(...) { if (dDebugFlag & DEBUG_DEBUG) { taosPrintLog("DND ", dDebugFlag, __VA_ARGS__); }}
|
|
||||||
#define dTrace(...) { if (dDebugFlag & DEBUG_TRACE) { taosPrintLog("DND ", dDebugFlag, __VA_ARGS__); }}
|
|
||||||
|
|
||||||
typedef enum { DND_STAT_INIT, DND_STAT_RUNNING, DND_STAT_STOPPED } EStat;
|
typedef enum { DND_STAT_INIT, DND_STAT_RUNNING, DND_STAT_STOPPED } EStat;
|
||||||
typedef enum { DND_WORKER_SINGLE, DND_WORKER_MULTI } EWorkerType;
|
typedef enum { DND_WORKER_SINGLE, DND_WORKER_MULTI } EWorkerType;
|
||||||
|
|
|
@ -34,46 +34,6 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern int32_t mDebugFlag;
|
|
||||||
|
|
||||||
// mnode log function
|
|
||||||
#define mFatal(...) \
|
|
||||||
{ \
|
|
||||||
if (mDebugFlag & DEBUG_FATAL) { \
|
|
||||||
taosPrintLog("MND FATAL ", 255, __VA_ARGS__); \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
#define mError(...) \
|
|
||||||
{ \
|
|
||||||
if (mDebugFlag & DEBUG_ERROR) { \
|
|
||||||
taosPrintLog("MND ERROR ", 255, __VA_ARGS__); \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
#define mWarn(...) \
|
|
||||||
{ \
|
|
||||||
if (mDebugFlag & DEBUG_WARN) { \
|
|
||||||
taosPrintLog("MND WARN ", 255, __VA_ARGS__); \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
#define mInfo(...) \
|
|
||||||
{ \
|
|
||||||
if (mDebugFlag & DEBUG_INFO) { \
|
|
||||||
taosPrintLog("MND ", 255, __VA_ARGS__); \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
#define mDebug(...) \
|
|
||||||
{ \
|
|
||||||
if (mDebugFlag & DEBUG_DEBUG) { \
|
|
||||||
taosPrintLog("MND ", mDebugFlag, __VA_ARGS__); \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
#define mTrace(...) \
|
|
||||||
{ \
|
|
||||||
if (mDebugFlag & DEBUG_TRACE) { \
|
|
||||||
taosPrintLog("MND ", mDebugFlag, __VA_ARGS__); \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
MND_AUTH_ACCT_START = 0,
|
MND_AUTH_ACCT_START = 0,
|
||||||
MND_AUTH_ACCT_USER,
|
MND_AUTH_ACCT_USER,
|
||||||
|
|
|
@ -31,6 +31,13 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define mFatal(...) { if (mDebugFlag & DEBUG_FATAL) { taosPrintLog("MND FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }}
|
||||||
|
#define mError(...) { if (mDebugFlag & DEBUG_ERROR) { taosPrintLog("MND ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }}
|
||||||
|
#define mWarn(...) { if (mDebugFlag & DEBUG_WARN) { taosPrintLog("MND WARN ", DEBUG_WARN, 255, __VA_ARGS__); }}
|
||||||
|
#define mInfo(...) { if (mDebugFlag & DEBUG_INFO) { taosPrintLog("MND ", DEBUG_INFO, 255, __VA_ARGS__); }}
|
||||||
|
#define mDebug(...) { if (mDebugFlag & DEBUG_DEBUG) { taosPrintLog("MND ", DEBUG_DEBUG, mDebugFlag, __VA_ARGS__); }}
|
||||||
|
#define mTrace(...) { if (mDebugFlag & DEBUG_TRACE) { taosPrintLog("MND ", DEBUG_TRACE, mDebugFlag, __VA_ARGS__); }}
|
||||||
|
|
||||||
typedef int32_t (*MndMsgFp)(SMnodeMsg *pMsg);
|
typedef int32_t (*MndMsgFp)(SMnodeMsg *pMsg);
|
||||||
typedef int32_t (*MndInitFp)(SMnode *pMnode);
|
typedef int32_t (*MndInitFp)(SMnode *pMnode);
|
||||||
typedef void (*MndCleanupFp)(SMnode *pMnode);
|
typedef void (*MndCleanupFp)(SMnode *pMnode);
|
||||||
|
|
|
@ -28,12 +28,12 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define mFatal(...) { if (mDebugFlag & DEBUG_FATAL) { taosPrintLog("MND FATAL ", 255, __VA_ARGS__); }}
|
#define mFatal(...) { if (mDebugFlag & DEBUG_FATAL) { taosPrintLog("MND FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }}
|
||||||
#define mError(...) { if (mDebugFlag & DEBUG_ERROR) { taosPrintLog("MND ERROR ", 255, __VA_ARGS__); }}
|
#define mError(...) { if (mDebugFlag & DEBUG_ERROR) { taosPrintLog("MND ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }}
|
||||||
#define mWarn(...) { if (mDebugFlag & DEBUG_WARN) { taosPrintLog("MND WARN ", 255, __VA_ARGS__); }}
|
#define mWarn(...) { if (mDebugFlag & DEBUG_WARN) { taosPrintLog("MND WARN ", DEBUG_WARN, 255, __VA_ARGS__); }}
|
||||||
#define mInfo(...) { if (mDebugFlag & DEBUG_INFO) { taosPrintLog("MND ", 255, __VA_ARGS__); }}
|
#define mInfo(...) { if (mDebugFlag & DEBUG_INFO) { taosPrintLog("MND ", DEBUG_INFO, 255, __VA_ARGS__); }}
|
||||||
#define mDebug(...) { if (mDebugFlag & DEBUG_DEBUG) { taosPrintLog("MND ", mDebugFlag, __VA_ARGS__); }}
|
#define mDebug(...) { if (mDebugFlag & DEBUG_DEBUG) { taosPrintLog("MND ", DEBUG_DEBUG, mDebugFlag, __VA_ARGS__); }}
|
||||||
#define mTrace(...) { if (mDebugFlag & DEBUG_TRACE) { taosPrintLog("MND ", mDebugFlag, __VA_ARGS__); }}
|
#define mTrace(...) { if (mDebugFlag & DEBUG_TRACE) { taosPrintLog("MND ", DEBUG_TRACE, mDebugFlag, __VA_ARGS__); }}
|
||||||
|
|
||||||
#define SDB_MAX_SIZE (32 * 1024)
|
#define SDB_MAX_SIZE (32 * 1024)
|
||||||
|
|
||||||
|
|
|
@ -25,42 +25,40 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern int32_t tqDebugFlag;
|
|
||||||
|
|
||||||
#define tqFatal(...) \
|
#define tqFatal(...) \
|
||||||
{ \
|
{ \
|
||||||
if (tqDebugFlag & DEBUG_FATAL) { \
|
if (tqDebugFlag & DEBUG_FATAL) { \
|
||||||
taosPrintLog("TQ FATAL ", 255, __VA_ARGS__); \
|
taosPrintLog("TQ FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#define tqError(...) \
|
#define tqError(...) \
|
||||||
{ \
|
{ \
|
||||||
if (tqDebugFlag & DEBUG_ERROR) { \
|
if (tqDebugFlag & DEBUG_ERROR) { \
|
||||||
taosPrintLog("TQ ERROR ", 255, __VA_ARGS__); \
|
taosPrintLog("TQ ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#define tqWarn(...) \
|
#define tqWarn(...) \
|
||||||
{ \
|
{ \
|
||||||
if (tqDebugFlag & DEBUG_WARN) { \
|
if (tqDebugFlag & DEBUG_WARN) { \
|
||||||
taosPrintLog("TQ WARN ", 255, __VA_ARGS__); \
|
taosPrintLog("TQ WARN ", DEBUG_WARN, 255, __VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#define tqInfo(...) \
|
#define tqInfo(...) \
|
||||||
{ \
|
{ \
|
||||||
if (tqDebugFlag & DEBUG_INFO) { \
|
if (tqDebugFlag & DEBUG_INFO) { \
|
||||||
taosPrintLog("TQ ", 255, __VA_ARGS__); \
|
taosPrintLog("TQ ", DEBUG_INFO, 255, __VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#define tqDebug(...) \
|
#define tqDebug(...) \
|
||||||
{ \
|
{ \
|
||||||
if (tqDebugFlag & DEBUG_DEBUG) { \
|
if (tqDebugFlag & DEBUG_DEBUG) { \
|
||||||
taosPrintLog("TQ ", tqDebugFlag, __VA_ARGS__); \
|
taosPrintLog("TQ ", DEBUG_DEBUG, tqDebugFlag, __VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#define tqTrace(...) \
|
#define tqTrace(...) \
|
||||||
{ \
|
{ \
|
||||||
if (tqDebugFlag & DEBUG_TRACE) { \
|
if (tqDebugFlag & DEBUG_TRACE) { \
|
||||||
taosPrintLog("TQ ", tqDebugFlag, __VA_ARGS__); \
|
taosPrintLog("TQ ", DEBUG_TRACE, tqDebugFlag, __VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,11 +20,11 @@
|
||||||
|
|
||||||
extern int32_t tsdbDebugFlag;
|
extern int32_t tsdbDebugFlag;
|
||||||
|
|
||||||
#define tsdbFatal(...) do { if (tsdbDebugFlag & DEBUG_FATAL) { taosPrintLog("TDB FATAL ", 255, __VA_ARGS__); }} while(0)
|
#define tsdbFatal(...) do { if (tsdbDebugFlag & DEBUG_FATAL) { taosPrintLog("TDB FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }} while(0)
|
||||||
#define tsdbError(...) do { if (tsdbDebugFlag & DEBUG_ERROR) { taosPrintLog("TDB ERROR ", 255, __VA_ARGS__); }} while(0)
|
#define tsdbError(...) do { if (tsdbDebugFlag & DEBUG_ERROR) { taosPrintLog("TDB ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }} while(0)
|
||||||
#define tsdbWarn(...) do { if (tsdbDebugFlag & DEBUG_WARN) { taosPrintLog("TDB WARN ", 255, __VA_ARGS__); }} while(0)
|
#define tsdbWarn(...) do { if (tsdbDebugFlag & DEBUG_WARN) { taosPrintLog("TDB WARN ", DEBUG_WARN, 255, __VA_ARGS__); }} while(0)
|
||||||
#define tsdbInfo(...) do { if (tsdbDebugFlag & DEBUG_INFO) { taosPrintLog("TDB ", 255, __VA_ARGS__); }} while(0)
|
#define tsdbInfo(...) do { if (tsdbDebugFlag & DEBUG_INFO) { taosPrintLog("TDB ", DEBUG_INFO, 255, __VA_ARGS__); }} while(0)
|
||||||
#define tsdbDebug(...) do { if (tsdbDebugFlag & DEBUG_DEBUG) { taosPrintLog("TDB ", tsdbDebugFlag, __VA_ARGS__); }} while(0)
|
#define tsdbDebug(...) do { if (tsdbDebugFlag & DEBUG_DEBUG) { taosPrintLog("TDB ", DEBUG_DEBUG, tsdbDebugFlag, __VA_ARGS__); }} while(0)
|
||||||
#define tsdbTrace(...) do { if (tsdbDebugFlag & DEBUG_TRACE) { taosPrintLog("TDB ", tsdbDebugFlag, __VA_ARGS__); }} while(0)
|
#define tsdbTrace(...) do { if (tsdbDebugFlag & DEBUG_TRACE) { taosPrintLog("TDB ", DEBUG_TRACE, tsdbDebugFlag, __VA_ARGS__); }} while(0)
|
||||||
|
|
||||||
#endif /* _TD_TSDB_LOG_H_ */
|
#endif /* _TD_TSDB_LOG_H_ */
|
|
@ -88,43 +88,40 @@ int vnodeScheduleTask(SVnodeTask* task);
|
||||||
int32_t vnodePutReqToVQueryQ(SVnode* pVnode, struct SRpcMsg* pReq);
|
int32_t vnodePutReqToVQueryQ(SVnode* pVnode, struct SRpcMsg* pReq);
|
||||||
void vnodeSendReqToDnode(SVnode* pVnode, struct SEpSet* epSet, struct SRpcMsg* pReq);
|
void vnodeSendReqToDnode(SVnode* pVnode, struct SEpSet* epSet, struct SRpcMsg* pReq);
|
||||||
|
|
||||||
// For Log
|
|
||||||
extern int32_t vDebugFlag;
|
|
||||||
|
|
||||||
#define vFatal(...) \
|
#define vFatal(...) \
|
||||||
do { \
|
do { \
|
||||||
if (vDebugFlag & DEBUG_FATAL) { \
|
if (vDebugFlag & DEBUG_FATAL) { \
|
||||||
taosPrintLog("VND FATAL ", 255, __VA_ARGS__); \
|
taosPrintLog("VND FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
#define vError(...) \
|
#define vError(...) \
|
||||||
do { \
|
do { \
|
||||||
if (vDebugFlag & DEBUG_ERROR) { \
|
if (vDebugFlag & DEBUG_ERROR) { \
|
||||||
taosPrintLog("VND ERROR ", 255, __VA_ARGS__); \
|
taosPrintLog("VND ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
#define vWarn(...) \
|
#define vWarn(...) \
|
||||||
do { \
|
do { \
|
||||||
if (vDebugFlag & DEBUG_WARN) { \
|
if (vDebugFlag & DEBUG_WARN) { \
|
||||||
taosPrintLog("VND WARN ", 255, __VA_ARGS__); \
|
taosPrintLog("VND WARN ", DEBUG_WARN, 255, __VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
#define vInfo(...) \
|
#define vInfo(...) \
|
||||||
do { \
|
do { \
|
||||||
if (vDebugFlag & DEBUG_INFO) { \
|
if (vDebugFlag & DEBUG_INFO) { \
|
||||||
taosPrintLog("VND ", 255, __VA_ARGS__); \
|
taosPrintLog("VND ", DEBUG_INFO, 255, __VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
#define vDebug(...) \
|
#define vDebug(...) \
|
||||||
do { \
|
do { \
|
||||||
if (vDebugFlag & DEBUG_DEBUG) { \
|
if (vDebugFlag & DEBUG_DEBUG) { \
|
||||||
taosPrintLog("VND ", tsdbDebugFlag, __VA_ARGS__); \
|
taosPrintLog("VND ", DEBUG_DEBUG, tsdbDebugFlag, __VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
#define vTrace(...) \
|
#define vTrace(...) \
|
||||||
do { \
|
do { \
|
||||||
if (vDebugFlag & DEBUG_TRACE) { \
|
if (vDebugFlag & DEBUG_TRACE) { \
|
||||||
taosPrintLog("VND ", tsdbDebugFlag, __VA_ARGS__); \
|
taosPrintLog("VND ", DEBUG_TRACE, tsdbDebugFlag, __VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
|
|
@ -128,37 +128,37 @@ int32_t indexSerialCacheKey(ICacheKey* key, char* buf);
|
||||||
#define indexFatal(...) \
|
#define indexFatal(...) \
|
||||||
do { \
|
do { \
|
||||||
if (sDebugFlag & DEBUG_FATAL) { \
|
if (sDebugFlag & DEBUG_FATAL) { \
|
||||||
taosPrintLog("index FATAL ", 255, __VA_ARGS__); \
|
taosPrintLog("index FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
#define indexError(...) \
|
#define indexError(...) \
|
||||||
do { \
|
do { \
|
||||||
if (sDebugFlag & DEBUG_ERROR) { \
|
if (sDebugFlag & DEBUG_ERROR) { \
|
||||||
taosPrintLog("index ERROR ", 255, __VA_ARGS__); \
|
taosPrintLog("index ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
#define indexWarn(...) \
|
#define indexWarn(...) \
|
||||||
do { \
|
do { \
|
||||||
if (sDebugFlag & DEBUG_WARN) { \
|
if (sDebugFlag & DEBUG_WARN) { \
|
||||||
taosPrintLog("index WARN ", 255, __VA_ARGS__); \
|
taosPrintLog("index WARN ", DEBUG_WARN, 255, __VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
#define indexInfo(...) \
|
#define indexInfo(...) \
|
||||||
do { \
|
do { \
|
||||||
if (sDebugFlag & DEBUG_INFO) { \
|
if (sDebugFlag & DEBUG_INFO) { \
|
||||||
taosPrintLog("index ", 255, __VA_ARGS__); \
|
taosPrintLog("index ", DEBUG_INFO, 255, __VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
#define indexDebug(...) \
|
#define indexDebug(...) \
|
||||||
do { \
|
do { \
|
||||||
if (sDebugFlag & DEBUG_DEBUG) { \
|
if (sDebugFlag & DEBUG_DEBUG) { \
|
||||||
taosPrintLog("index ", sDebugFlag, __VA_ARGS__); \
|
taosPrintLog("index ", DEBUG_DEBUG, sDebugFlag, __VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
#define indexTrace(...) \
|
#define indexTrace(...) \
|
||||||
do { \
|
do { \
|
||||||
if (sDebugFlag & DEBUG_TRACE) { \
|
if (sDebugFlag & DEBUG_TRACE) { \
|
||||||
taosPrintLog("index ", sDebugFlag, __VA_ARGS__); \
|
taosPrintLog("index ", DEBUG_TRACE, sDebugFlag, __VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
|
|
@ -270,15 +270,15 @@ void monSetDiskInfo(SMonInfo *pMonitor, SMonDiskInfo *pInfo) {
|
||||||
tjsonAddDoubleToObject(pTempdirJson, "total", pInfo->tempdir.size.total);
|
tjsonAddDoubleToObject(pTempdirJson, "total", pInfo->tempdir.size.total);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *monLogLevelStr(EMonLogLevel level) {
|
static const char *monLogLevelStr(ELogLevel level) {
|
||||||
switch (level) {
|
switch (level) {
|
||||||
case MON_LEVEL_ERROR:
|
case DEBUG_ERROR:
|
||||||
return "error";
|
return "error";
|
||||||
case MON_LEVEL_INFO:
|
case DEBUG_INFO:
|
||||||
return "info";
|
return "info";
|
||||||
case MON_LEVEL_DEBUG:
|
case DEBUG_DEBUG:
|
||||||
return "debug";
|
return "debug";
|
||||||
case MON_LEVEL_TRACE:
|
case DEBUG_TRACE:
|
||||||
return "trace";
|
return "trace";
|
||||||
default:
|
default:
|
||||||
return "undefine";
|
return "undefine";
|
||||||
|
@ -318,25 +318,25 @@ static void monSetLogInfo(SMonInfo *pMonitor) {
|
||||||
SJson *pLogError = tjsonCreateObject();
|
SJson *pLogError = tjsonCreateObject();
|
||||||
if (pLogError == NULL) return;
|
if (pLogError == NULL) return;
|
||||||
tjsonAddStringToObject(pLogError, "level", "error");
|
tjsonAddStringToObject(pLogError, "level", "error");
|
||||||
tjsonAddDoubleToObject(pLogError, "total", 1);
|
tjsonAddDoubleToObject(pLogError, "total", tsNumOfErrorLogs);
|
||||||
if (tjsonAddItemToArray(pSummaryJson, pLogError) != 0) tjsonDelete(pLogError);
|
if (tjsonAddItemToArray(pSummaryJson, pLogError) != 0) tjsonDelete(pLogError);
|
||||||
|
|
||||||
SJson *pLogInfo = tjsonCreateObject();
|
SJson *pLogInfo = tjsonCreateObject();
|
||||||
if (pLogInfo == NULL) return;
|
if (pLogInfo == NULL) return;
|
||||||
tjsonAddStringToObject(pLogInfo, "level", "info");
|
tjsonAddStringToObject(pLogInfo, "level", "info");
|
||||||
tjsonAddDoubleToObject(pLogInfo, "total", 1);
|
tjsonAddDoubleToObject(pLogInfo, "total", tsNumOfInfoLogs);
|
||||||
if (tjsonAddItemToArray(pSummaryJson, pLogInfo) != 0) tjsonDelete(pLogInfo);
|
if (tjsonAddItemToArray(pSummaryJson, pLogInfo) != 0) tjsonDelete(pLogInfo);
|
||||||
|
|
||||||
SJson *pLogDebug = tjsonCreateObject();
|
SJson *pLogDebug = tjsonCreateObject();
|
||||||
if (pLogDebug == NULL) return;
|
if (pLogDebug == NULL) return;
|
||||||
tjsonAddStringToObject(pLogDebug, "level", "debug");
|
tjsonAddStringToObject(pLogDebug, "level", "debug");
|
||||||
tjsonAddDoubleToObject(pLogDebug, "total", 1);
|
tjsonAddDoubleToObject(pLogDebug, "total", tsNumOfDebugLogs);
|
||||||
if (tjsonAddItemToArray(pSummaryJson, pLogDebug) != 0) tjsonDelete(pLogDebug);
|
if (tjsonAddItemToArray(pSummaryJson, pLogDebug) != 0) tjsonDelete(pLogDebug);
|
||||||
|
|
||||||
SJson *pLogTrace = tjsonCreateObject();
|
SJson *pLogTrace = tjsonCreateObject();
|
||||||
if (pLogTrace == NULL) return;
|
if (pLogTrace == NULL) return;
|
||||||
tjsonAddStringToObject(pLogTrace, "level", "trace");
|
tjsonAddStringToObject(pLogTrace, "level", "trace");
|
||||||
tjsonAddDoubleToObject(pLogTrace, "total", 1);
|
tjsonAddDoubleToObject(pLogTrace, "total", tsNumOfTraceLogs);
|
||||||
if (tjsonAddItemToArray(pSummaryJson, pLogTrace) != 0) tjsonDelete(pLogTrace);
|
if (tjsonAddItemToArray(pSummaryJson, pLogTrace) != 0) tjsonDelete(pLogTrace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -195,19 +195,19 @@ void MonitorTest::GetDiskInfo(SMonInfo *pMonitor, SMonDiskInfo *pInfo) {
|
||||||
void MonitorTest::AddLogInfo1() {
|
void MonitorTest::AddLogInfo1() {
|
||||||
SMonLogItem log1 = {0};
|
SMonLogItem log1 = {0};
|
||||||
log1.ts = taosGetTimestampMs();
|
log1.ts = taosGetTimestampMs();
|
||||||
log1.level = MON_LEVEL_INFO;
|
log1.level = DEBUG_INFO;
|
||||||
strcpy(log1.content, "1 -------------------------- a");
|
strcpy(log1.content, "1 -------------------------- a");
|
||||||
monAddLogItem(&log1);
|
monAddLogItem(&log1);
|
||||||
|
|
||||||
SMonLogItem log2 = {0};
|
SMonLogItem log2 = {0};
|
||||||
log2.ts = taosGetTimestampMs();
|
log2.ts = taosGetTimestampMs();
|
||||||
log2.level = MON_LEVEL_ERROR;
|
log2.level = DEBUG_ERROR;
|
||||||
strcpy(log2.content, "1 ------------------------ b");
|
strcpy(log2.content, "1 ------------------------ b");
|
||||||
monAddLogItem(&log2);
|
monAddLogItem(&log2);
|
||||||
|
|
||||||
SMonLogItem log3 = {0};
|
SMonLogItem log3 = {0};
|
||||||
log3.ts = taosGetTimestampMs();
|
log3.ts = taosGetTimestampMs();
|
||||||
log3.level = MON_LEVEL_DEBUG;
|
log3.level = DEBUG_DEBUG;
|
||||||
strcpy(log3.content, "1 ------- c");
|
strcpy(log3.content, "1 ------- c");
|
||||||
monAddLogItem(&log3);
|
monAddLogItem(&log3);
|
||||||
}
|
}
|
||||||
|
@ -215,13 +215,13 @@ void MonitorTest::AddLogInfo1() {
|
||||||
void MonitorTest::AddLogInfo2() {
|
void MonitorTest::AddLogInfo2() {
|
||||||
SMonLogItem log1;
|
SMonLogItem log1;
|
||||||
log1.ts = taosGetTimestampMs();
|
log1.ts = taosGetTimestampMs();
|
||||||
log1.level = MON_LEVEL_ERROR;
|
log1.level = DEBUG_ERROR;
|
||||||
strcpy(log1.content, "2 ------- a");
|
strcpy(log1.content, "2 ------- a");
|
||||||
monAddLogItem(&log1);
|
monAddLogItem(&log1);
|
||||||
|
|
||||||
SMonLogItem log2;
|
SMonLogItem log2;
|
||||||
log2.ts = taosGetTimestampMs();
|
log2.ts = taosGetTimestampMs();
|
||||||
log2.level = MON_LEVEL_ERROR;
|
log2.level = DEBUG_ERROR;
|
||||||
strcpy(log2.content, "2 ------- b");
|
strcpy(log2.content, "2 ------- b");
|
||||||
monAddLogItem(&log2);
|
monAddLogItem(&log2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,42 +29,40 @@ extern "C" {
|
||||||
#include "tlog.h"
|
#include "tlog.h"
|
||||||
#include "ttimer.h"
|
#include "ttimer.h"
|
||||||
|
|
||||||
extern int32_t sDebugFlag;
|
|
||||||
|
|
||||||
#define sFatal(...) \
|
#define sFatal(...) \
|
||||||
{ \
|
{ \
|
||||||
if (sDebugFlag & DEBUG_FATAL) { \
|
if (sDebugFlag & DEBUG_FATAL) { \
|
||||||
taosPrintLog("SYN FATAL ", sDebugFlag, __VA_ARGS__); \
|
taosPrintLog("SYN FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#define sError(...) \
|
#define sError(...) \
|
||||||
{ \
|
{ \
|
||||||
if (sDebugFlag & DEBUG_ERROR) { \
|
if (sDebugFlag & DEBUG_ERROR) { \
|
||||||
taosPrintLog("SYN ERROR ", sDebugFlag, __VA_ARGS__); \
|
taosPrintLog("SYN ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#define sWarn(...) \
|
#define sWarn(...) \
|
||||||
{ \
|
{ \
|
||||||
if (sDebugFlag & DEBUG_WARN) { \
|
if (sDebugFlag & DEBUG_WARN) { \
|
||||||
taosPrintLog("SYN WARN ", sDebugFlag, __VA_ARGS__); \
|
taosPrintLog("SYN WARN ", DEBUG_WARN, 255, __VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#define sInfo(...) \
|
#define sInfo(...) \
|
||||||
{ \
|
{ \
|
||||||
if (sDebugFlag & DEBUG_INFO) { \
|
if (sDebugFlag & DEBUG_INFO) { \
|
||||||
taosPrintLog("SYN INFO ", sDebugFlag, __VA_ARGS__); \
|
taosPrintLog("SYN INFO ", DEBUG_INFO, 255, __VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#define sDebug(...) \
|
#define sDebug(...) \
|
||||||
{ \
|
{ \
|
||||||
if (sDebugFlag & DEBUG_DEBUG) { \
|
if (sDebugFlag & DEBUG_DEBUG) { \
|
||||||
taosPrintLog("SYN DEBUG ", sDebugFlag, __VA_ARGS__); \
|
taosPrintLog("SYN DEBUG ", DEBUG_DEBUG, sDebugFlag, __VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#define sTrace(...) \
|
#define sTrace(...) \
|
||||||
{ \
|
{ \
|
||||||
if (sDebugFlag & DEBUG_TRACE) { \
|
if (sDebugFlag & DEBUG_TRACE) { \
|
||||||
taosPrintLog("SYN TRACE ", sDebugFlag, __VA_ARGS__); \
|
taosPrintLog("SYN TRACE ", DEBUG_TRACE, sDebugFlag, __VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,15 +25,13 @@
|
||||||
#include "thash.h"
|
#include "thash.h"
|
||||||
#include "tlog.h"
|
#include "tlog.h"
|
||||||
|
|
||||||
extern int32_t fsDebugFlag;
|
|
||||||
|
|
||||||
// For debug purpose
|
// For debug purpose
|
||||||
#define fFatal(...) { if (fsDebugFlag & DEBUG_FATAL) { taosPrintLog("TFS FATAL ", 255, __VA_ARGS__); }}
|
#define fFatal(...) { if (fsDebugFlag & DEBUG_FATAL) { taosPrintLog("TFS FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }}
|
||||||
#define fError(...) { if (fsDebugFlag & DEBUG_ERROR) { taosPrintLog("TFS ERROR ", 255, __VA_ARGS__); }}
|
#define fError(...) { if (fsDebugFlag & DEBUG_ERROR) { taosPrintLog("TFS ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }}
|
||||||
#define fWarn(...) { if (fsDebugFlag & DEBUG_WARN) { taosPrintLog("TFS WARN ", 255, __VA_ARGS__); }}
|
#define fWarn(...) { if (fsDebugFlag & DEBUG_WARN) { taosPrintLog("TFS WARN ", DEBUG_WARN, 255, __VA_ARGS__); }}
|
||||||
#define fInfo(...) { if (fsDebugFlag & DEBUG_INFO) { taosPrintLog("TFS ", 255, __VA_ARGS__); }}
|
#define fInfo(...) { if (fsDebugFlag & DEBUG_INFO) { taosPrintLog("TFS ", DEBUG_INFO, 255, __VA_ARGS__); }}
|
||||||
#define fDebug(...) { if (fsDebugFlag & DEBUG_DEBUG) { taosPrintLog("TFS ", fsDebugFlag, __VA_ARGS__); }}
|
#define fDebug(...) { if (fsDebugFlag & DEBUG_DEBUG) { taosPrintLog("TFS ", DEBUG_DEBUG, fsDebugFlag, __VA_ARGS__); }}
|
||||||
#define fTrace(...) { if (fsDebugFlag & DEBUG_TRACE) { taosPrintLog("TFS ", fsDebugFlag, __VA_ARGS__); }}
|
#define fTrace(...) { if (fsDebugFlag & DEBUG_TRACE) { taosPrintLog("TFS ", DEBUG_TRACE, fsDebugFlag, __VA_ARGS__); }}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int32_t level;
|
int32_t level;
|
||||||
|
|
|
@ -22,43 +22,40 @@ extern "C" {
|
||||||
|
|
||||||
#include "tlog.h"
|
#include "tlog.h"
|
||||||
|
|
||||||
extern int32_t rpcDebugFlag;
|
|
||||||
|
|
||||||
// rpcDebugFlag = 143
|
|
||||||
#define tFatal(...) \
|
#define tFatal(...) \
|
||||||
{ \
|
{ \
|
||||||
if (rpcDebugFlag & DEBUG_FATAL) { \
|
if (rpcDebugFlag & DEBUG_FATAL) { \
|
||||||
taosPrintLog("RPC FATAL ", rpcDebugFlag, __VA_ARGS__); \
|
taosPrintLog("RPC FATAL ", DEBUG_FATAL, rpcDebugFlag, __VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#define tError(...) \
|
#define tError(...) \
|
||||||
{ \
|
{ \
|
||||||
if (rpcDebugFlag & DEBUG_ERROR) { \
|
if (rpcDebugFlag & DEBUG_ERROR) { \
|
||||||
taosPrintLog("RPC ERROR ", rpcDebugFlag, __VA_ARGS__); \
|
taosPrintLog("RPC ERROR ", DEBUG_ERROR, rpcDebugFlag, __VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#define tWarn(...) \
|
#define tWarn(...) \
|
||||||
{ \
|
{ \
|
||||||
if (rpcDebugFlag & DEBUG_WARN) { \
|
if (rpcDebugFlag & DEBUG_WARN) { \
|
||||||
taosPrintLog("RPC WARN ", rpcDebugFlag, __VA_ARGS__); \
|
taosPrintLog("RPC WARN ", DEBUG_WARN, rpcDebugFlag, __VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#define tInfo(...) \
|
#define tInfo(...) \
|
||||||
{ \
|
{ \
|
||||||
if (rpcDebugFlag & DEBUG_INFO) { \
|
if (rpcDebugFlag & DEBUG_INFO) { \
|
||||||
taosPrintLog("RPC ", rpcDebugFlag, __VA_ARGS__); \
|
taosPrintLog("RPC ", DEBUG_INFO, rpcDebugFlag, __VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#define tDebug(...) \
|
#define tDebug(...) \
|
||||||
{ \
|
{ \
|
||||||
if (rpcDebugFlag & DEBUG_DEBUG) { \
|
if (rpcDebugFlag & DEBUG_DEBUG) { \
|
||||||
taosPrintLog("RPC ", rpcDebugFlag, __VA_ARGS__); \
|
taosPrintLog("RPC ", DEBUG_DEBUG, rpcDebugFlag, __VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#define tTrace(...) \
|
#define tTrace(...) \
|
||||||
{ \
|
{ \
|
||||||
if (rpcDebugFlag & DEBUG_TRACE) { \
|
if (rpcDebugFlag & DEBUG_TRACE) { \
|
||||||
taosPrintLog("RPC ", rpcDebugFlag, __VA_ARGS__); \
|
taosPrintLog("RPC ", DEBUG_TRACE, rpcDebugFlag, __VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#define tDump(x, y) \
|
#define tDump(x, y) \
|
||||||
|
|
|
@ -63,7 +63,7 @@ int32_t taosSendHttpReport(const char* server, uint16_t port, const char* pCont,
|
||||||
goto SEND_OVER;
|
goto SEND_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
uInfo("send http to %s:%u, len:%d content: %s", server, port, contLen, pCont);
|
uTrace("send http to %s:%u, len:%d content: %s", server, port, contLen, pCont);
|
||||||
code = 0;
|
code = 0;
|
||||||
|
|
||||||
SEND_OVER:
|
SEND_OVER:
|
||||||
|
|
|
@ -376,7 +376,27 @@ static int32_t taosOpenLogFile(char *fn, int32_t maxLines, int32_t maxFileNum) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void taosPrintLog(const char *flags, int32_t dflag, const char *format, ...) {
|
static void taosUpdateLogNums(ELogLevel level) {
|
||||||
|
switch (level) {
|
||||||
|
case DEBUG_ERROR:
|
||||||
|
atomic_add_fetch_64(&tsNumOfErrorLogs, 1);
|
||||||
|
break;
|
||||||
|
case DEBUG_INFO:
|
||||||
|
atomic_add_fetch_64(&tsNumOfInfoLogs, 1);
|
||||||
|
break;
|
||||||
|
case DEBUG_DEBUG:
|
||||||
|
atomic_add_fetch_64(&tsNumOfDebugLogs, 1);
|
||||||
|
break;
|
||||||
|
case DEBUG_DUMP:
|
||||||
|
case DEBUG_TRACE:
|
||||||
|
atomic_add_fetch_64(&tsNumOfTraceLogs, 1);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void taosPrintLog(const char *flags, ELogLevel level, int32_t dflag, const char *format, ...) {
|
||||||
if (!osLogSpaceAvailable()) return;
|
if (!osLogSpaceAvailable()) return;
|
||||||
|
|
||||||
va_list argpointer;
|
va_list argpointer;
|
||||||
|
@ -414,6 +434,7 @@ void taosPrintLog(const char *flags, int32_t dflag, const char *format, ...) {
|
||||||
buffer[len] = 0;
|
buffer[len] = 0;
|
||||||
|
|
||||||
if ((dflag & DEBUG_FILE) && tsLogObj.logHandle && tsLogObj.logHandle->pFile != NULL) {
|
if ((dflag & DEBUG_FILE) && tsLogObj.logHandle && tsLogObj.logHandle->pFile != NULL) {
|
||||||
|
taosUpdateLogNums(level);
|
||||||
if (tsAsyncLog) {
|
if (tsAsyncLog) {
|
||||||
taosPushLogBuffer(tsLogObj.logHandle, buffer, len);
|
taosPushLogBuffer(tsLogObj.logHandle, buffer, len);
|
||||||
} else {
|
} else {
|
||||||
|
@ -427,11 +448,14 @@ void taosPrintLog(const char *flags, int32_t dflag, const char *format, ...) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dflag & DEBUG_SCREEN) write(1, buffer, (uint32_t)len);
|
if (dflag & DEBUG_SCREEN) {
|
||||||
|
write(1, buffer, (uint32_t)len);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void taosDumpData(unsigned char *msg, int32_t len) {
|
void taosDumpData(unsigned char *msg, int32_t len) {
|
||||||
if (!osLogSpaceAvailable()) return;
|
if (!osLogSpaceAvailable()) return;
|
||||||
|
taosUpdateLogNums(DEBUG_DUMP);
|
||||||
|
|
||||||
char temp[256];
|
char temp[256];
|
||||||
int32_t i, pos = 0, c = 0;
|
int32_t i, pos = 0, c = 0;
|
||||||
|
@ -453,7 +477,7 @@ void taosDumpData(unsigned char *msg, int32_t len) {
|
||||||
taosWriteFile(tsLogObj.logHandle->pFile, temp, (uint32_t)pos);
|
taosWriteFile(tsLogObj.logHandle->pFile, temp, (uint32_t)pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void taosPrintLongString(const char *flags, int32_t dflag, const char *format, ...) {
|
void taosPrintLongString(const char *flags, ELogLevel level, int32_t dflag, const char *format, ...) {
|
||||||
if (!osLogSpaceAvailable()) return;
|
if (!osLogSpaceAvailable()) return;
|
||||||
|
|
||||||
va_list argpointer;
|
va_list argpointer;
|
||||||
|
@ -481,6 +505,7 @@ void taosPrintLongString(const char *flags, int32_t dflag, const char *format, .
|
||||||
buffer[len] = 0;
|
buffer[len] = 0;
|
||||||
|
|
||||||
if ((dflag & DEBUG_FILE) && tsLogObj.logHandle && tsLogObj.logHandle->pFile != NULL) {
|
if ((dflag & DEBUG_FILE) && tsLogObj.logHandle && tsLogObj.logHandle->pFile != NULL) {
|
||||||
|
taosUpdateLogNums(level);
|
||||||
if (tsAsyncLog) {
|
if (tsAsyncLog) {
|
||||||
taosPushLogBuffer(tsLogObj.logHandle, buffer, len);
|
taosPushLogBuffer(tsLogObj.logHandle, buffer, len);
|
||||||
} else {
|
} else {
|
||||||
|
@ -494,7 +519,9 @@ void taosPrintLongString(const char *flags, int32_t dflag, const char *format, .
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dflag & DEBUG_SCREEN) write(1, buffer, (uint32_t)len);
|
if (dflag & DEBUG_SCREEN) {
|
||||||
|
write(1, buffer, (uint32_t)len);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void taosCloseLogByFd(TdFilePtr pFile) {
|
static void taosCloseLogByFd(TdFilePtr pFile) {
|
||||||
|
|
|
@ -22,37 +22,37 @@
|
||||||
#define tmrFatal(...) \
|
#define tmrFatal(...) \
|
||||||
{ \
|
{ \
|
||||||
if (tmrDebugFlag & DEBUG_FATAL) { \
|
if (tmrDebugFlag & DEBUG_FATAL) { \
|
||||||
taosPrintLog("TMR FATAL ", tmrDebugFlag, __VA_ARGS__); \
|
taosPrintLog("TMR FATAL ", DEBUG_FATAL, tmrDebugFlag, __VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#define tmrError(...) \
|
#define tmrError(...) \
|
||||||
{ \
|
{ \
|
||||||
if (tmrDebugFlag & DEBUG_ERROR) { \
|
if (tmrDebugFlag & DEBUG_ERROR) { \
|
||||||
taosPrintLog("TMR ERROR ", tmrDebugFlag, __VA_ARGS__); \
|
taosPrintLog("TMR ERROR ", DEBUG_ERROR, tmrDebugFlag, __VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#define tmrWarn(...) \
|
#define tmrWarn(...) \
|
||||||
{ \
|
{ \
|
||||||
if (tmrDebugFlag & DEBUG_WARN) { \
|
if (tmrDebugFlag & DEBUG_WARN) { \
|
||||||
taosPrintLog("TMR WARN ", tmrDebugFlag, __VA_ARGS__); \
|
taosPrintLog("TMR WARN ", DEBUG_WARN, tmrDebugFlag, __VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#define tmrInfo(...) \
|
#define tmrInfo(...) \
|
||||||
{ \
|
{ \
|
||||||
if (tmrDebugFlag & DEBUG_INFO) { \
|
if (tmrDebugFlag & DEBUG_INFO) { \
|
||||||
taosPrintLog("TMR ", tmrDebugFlag, __VA_ARGS__); \
|
taosPrintLog("TMR ", DEBUG_INFO, tmrDebugFlag, __VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#define tmrDebug(...) \
|
#define tmrDebug(...) \
|
||||||
{ \
|
{ \
|
||||||
if (tmrDebugFlag & DEBUG_DEBUG) { \
|
if (tmrDebugFlag & DEBUG_DEBUG) { \
|
||||||
taosPrintLog("TMR ", tmrDebugFlag, __VA_ARGS__); \
|
taosPrintLog("TMR ", DEBUG_DEBUG, tmrDebugFlag, __VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#define tmrTrace(...) \
|
#define tmrTrace(...) \
|
||||||
{ \
|
{ \
|
||||||
if (tmrDebugFlag & DEBUG_TRACE) { \
|
if (tmrDebugFlag & DEBUG_TRACE) { \
|
||||||
taosPrintLog("TMR ", tmrDebugFlag, __VA_ARGS__); \
|
taosPrintLog("TMR ", DEBUG_TRACE, tmrDebugFlag, __VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue