cc log levels corr

This commit is contained in:
dimxy
2019-02-12 02:01:52 +05:00
parent 0b8fffc501
commit 9fdb634a4e
2 changed files with 6 additions and 5 deletions

View File

@@ -266,6 +266,7 @@ UniValue ValueFromAmount(const CAmount& amount);
#define CCLOG_DEBUG1 1 #define CCLOG_DEBUG1 1
#define CCLOG_DEBUG2 2 #define CCLOG_DEBUG2 2
#define CCLOG_DEBUG3 3 #define CCLOG_DEBUG3 3
#define CCLOG_MAXLEVEL 3
template <class T> template <class T>
inline void CCLogPrintStream(const char *category, int level, T print_to_stream) 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); print_to_stream(stream);
if (level < 0) if (level < 0)
level = 0; level = 0;
if (level > 3) if (level > CCLOG_MAXLEVEL)
level = 3; level = CCLOG_MAXLEVEL;
for (int i = 0; i < level; i++) for (int i = level; i <= CCLOG_MAXLEVEL; i++)
if (LogAcceptCategory((std::string(category) + (level > 0 ? std::string("-") + std::to_string(level) : std::string(""))).c_str())) { if (LogAcceptCategory((std::string(category) + (i > 0 ? std::string("-") + std::to_string(i) : std::string(""))).c_str())) {
LogPrintStr(stream.str()); LogPrintStr(stream.str());
break; break;
} }

View File

@@ -178,7 +178,7 @@ uint8_t DecodeTokenOpRet(const CScript scriptPubKey, uint8_t &evalCodeTokens, ui
return (uint8_t)0; return (uint8_t)0;
funcId = script[1]; 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 ) switch( funcId )
{ {