diff --git a/include/util/tlog.h b/include/util/tlog.h index 6e6795e9a2c6c564e8d5dc4fe0bd642401907141..920392198560c69f3dcb9e87e64f3c37d6090b8f 100644 --- a/include/util/tlog.h +++ b/include/util/tlog.h @@ -22,9 +22,24 @@ extern "C" { #endif +#define DEBUG_FATAL 1U +#define DEBUG_ERROR DEBUG_FATAL +#define DEBUG_WARN 2U +#define DEBUG_INFO DEBUG_WARN +#define DEBUG_DEBUG 4U +#define DEBUG_TRACE 8U +#define DEBUG_DUMP 16U +#define DEBUG_SCREEN 64U +#define DEBUG_FILE 128U + +extern bool tsLogEmbedded; extern bool tsAsyncLog; extern int32_t tsNumOfLogLines; extern int32_t tsLogKeepDays; +extern int64_t tsNumOfErrorLogs; +extern int64_t tsNumOfInfoLogs; +extern int64_t tsNumOfDebugLogs; +extern int64_t tsNumOfTraceLogs; extern int32_t dDebugFlag; extern int32_t vDebugFlag; extern int32_t mDebugFlag; @@ -40,16 +55,6 @@ extern int32_t tsdbDebugFlag; extern int32_t tqDebugFlag; extern int32_t fsDebugFlag; -#define DEBUG_FATAL 1U -#define DEBUG_ERROR DEBUG_FATAL -#define DEBUG_WARN 2U -#define DEBUG_INFO DEBUG_WARN -#define DEBUG_DEBUG 4U -#define DEBUG_TRACE 8U -#define DEBUG_DUMP 16U -#define DEBUG_SCREEN 64U -#define DEBUG_FILE 128U - int32_t taosInitLog(const char *logName, int32_t maxFiles); void taosCloseLog(); void taosResetLog(); @@ -68,12 +73,10 @@ void taosPrintLongString(const char *flags, int32_t dflag, const char *format, . #endif ; -extern int8_t tscEmbeddedInUtil; - -#define uFatal(...) { if (uDebugFlag & DEBUG_FATAL) { taosPrintLog("UTL FATAL", tscEmbeddedInUtil ? 255 : uDebugFlag, __VA_ARGS__); }} -#define uError(...) { if (uDebugFlag & DEBUG_ERROR) { taosPrintLog("UTL ERROR ", tscEmbeddedInUtil ? 255 : uDebugFlag, __VA_ARGS__); }} -#define uWarn(...) { if (uDebugFlag & DEBUG_WARN) { taosPrintLog("UTL WARN ", tscEmbeddedInUtil ? 255 : uDebugFlag, __VA_ARGS__); }} -#define uInfo(...) { if (uDebugFlag & DEBUG_INFO) { taosPrintLog("UTL ", tscEmbeddedInUtil ? 255 : uDebugFlag, __VA_ARGS__); }} +#define uFatal(...) { if (uDebugFlag & DEBUG_FATAL) { taosPrintLog("UTL FATAL", tsLogEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }} +#define uError(...) { if (uDebugFlag & DEBUG_ERROR) { taosPrintLog("UTL ERROR ", tsLogEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }} +#define uWarn(...) { if (uDebugFlag & DEBUG_WARN) { taosPrintLog("UTL WARN ", tsLogEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }} +#define uInfo(...) { if (uDebugFlag & DEBUG_INFO) { taosPrintLog("UTL ", tsLogEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }} #define uDebug(...) { if (uDebugFlag & DEBUG_DEBUG) { taosPrintLog("UTL ", uDebugFlag, __VA_ARGS__); }} #define uTrace(...) { if (uDebugFlag & DEBUG_TRACE) { taosPrintLog("UTL ", uDebugFlag, __VA_ARGS__); }} diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index a7e99b594f9988ec4b18db77439b05704673fb31..264e54aafe2c6f3e04e35f7b92d652a2bc0e9af2 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -478,10 +478,10 @@ int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDi if (pCfg == NULL) return -1; if (tsc) { - tscEmbeddedInUtil = 0; + tsLogEmbedded = 0; if (taosAddClientLogCfg(pCfg) != 0) return -1; } else { - tscEmbeddedInUtil = 1; + tsLogEmbedded = 1; if (taosAddClientLogCfg(pCfg) != 0) return -1; if (taosAddServerLogCfg(pCfg) != 0) return -1; } diff --git a/source/dnode/mgmt/impl/test/sut/src/sut.cpp b/source/dnode/mgmt/impl/test/sut/src/sut.cpp index 00a79ebfd9b2d45ce6f6e2bc7f888f4f0522edba..2e38ea75137f4120b4611db8c6f133164e05cee2 100644 --- a/source/dnode/mgmt/impl/test/sut/src/sut.cpp +++ b/source/dnode/mgmt/impl/test/sut/src/sut.cpp @@ -28,7 +28,7 @@ void Testbase::InitLog(const char* path) { wDebugFlag = 0; sDebugFlag = 0; tsdbDebugFlag = 0; - tscEmbeddedInUtil = 1; + tsLogEmbedded = 1; tsAsyncLog = 0; taosRemoveDir(path); diff --git a/source/libs/transport/test/transUT.cc b/source/libs/transport/test/transUT.cc index 6db709da513b6f169d12ea9e8aa3f9292544d2a1..5c364a4c33c4a872145188177cc48972ed313db3 100644 --- a/source/libs/transport/test/transUT.cc +++ b/source/libs/transport/test/transUT.cc @@ -148,7 +148,7 @@ class TransObj { wDebugFlag = 0; sDebugFlag = 0; tsdbDebugFlag = 0; - tscEmbeddedInUtil = 1; + tsLogEmbedded = 1; tsAsyncLog = 0; std::string path = "/tmp/transport"; diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c index d821e0440b814f28e6e9274261f21fffac10b00d..1ddb63605884275b2458e9e6235648b76344a5f1 100644 --- a/source/util/src/tlog.c +++ b/source/util/src/tlog.c @@ -66,13 +66,17 @@ typedef struct { static int8_t tsLogInited = 0; static SLogObj tsLogObj = {.fileNum = 1}; +static int64_t tsAsyncLogLostLines = 0; +static int32_t tsWriteInterval = LOG_DEFAULT_INTERVAL; -int8_t tscEmbeddedInUtil = 0; -int32_t tsLogKeepDays = 0; +bool tsLogEmbedded = 0; bool tsAsyncLog = true; int32_t tsNumOfLogLines = 10000000; -int64_t tsAsyncLogLostLines = 0; -int32_t tsWriteInterval = LOG_DEFAULT_INTERVAL; +int32_t tsLogKeepDays = 0; +int64_t tsNumOfErrorLogs = 0; +int64_t tsNumOfInfoLogs = 0; +int64_t tsNumOfDebugLogs = 0; +int64_t tsNumOfTraceLogs = 0; // log int32_t dDebugFlag = 135;