From 9fdb634a4ea378e4887cb73ea2b09c2e3c7dede5 Mon Sep 17 00:00:00 2001 From: dimxy Date: Tue, 12 Feb 2019 02:01:52 +0500 Subject: [PATCH] cc log levels corr --- src/cc/CCinclude.h | 9 +++++---- src/cc/CCtokens.cpp | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/cc/CCinclude.h b/src/cc/CCinclude.h index 6018114a0..a2d782c3f 100644 --- a/src/cc/CCinclude.h +++ b/src/cc/CCinclude.h @@ -266,6 +266,7 @@ UniValue ValueFromAmount(const CAmount& amount); #define CCLOG_DEBUG1 1 #define CCLOG_DEBUG2 2 #define CCLOG_DEBUG3 3 +#define CCLOG_MAXLEVEL 3 template inline void CCLogPrintStream(const char *category, int level, T print_to_stream) { @@ -273,10 +274,10 @@ inline void CCLogPrintStream(const char *category, int level, T print_to_stream) print_to_stream(stream); if (level < 0) level = 0; - if (level > 3) - level = 3; - for (int i = 0; i < level; i++) - if (LogAcceptCategory((std::string(category) + (level > 0 ? std::string("-") + std::to_string(level) : std::string(""))).c_str())) { + if (level > CCLOG_MAXLEVEL) + level = CCLOG_MAXLEVEL; + for (int i = level; i <= CCLOG_MAXLEVEL; i++) + if (LogAcceptCategory((std::string(category) + (i > 0 ? std::string("-") + std::to_string(i) : std::string(""))).c_str())) { LogPrintStr(stream.str()); break; } diff --git a/src/cc/CCtokens.cpp b/src/cc/CCtokens.cpp index 6e1afbf33..c6e2498cf 100644 --- a/src/cc/CCtokens.cpp +++ b/src/cc/CCtokens.cpp @@ -178,7 +178,7 @@ uint8_t DecodeTokenOpRet(const CScript scriptPubKey, uint8_t &evalCodeTokens, ui return (uint8_t)0; funcId = script[1]; - LOGSTREAM((char *)"cctokens", CCLOG_DEBUG2, stream << "DecodeTokenOpRet decoded funcId=" << (char)(funcId?funcId:' ')); + LOGSTREAM((char *)"cctokens", CCLOG_DEBUG2, stream << "DecodeTokenOpRet decoded funcId=" << (char)(funcId?funcId:' ') << std::endl); switch( funcId ) {