From 43b2da63db011238501f5b07d26d45e3d9548f6c Mon Sep 17 00:00:00 2001 From: Terry Moore Date: Sun, 21 Apr 2019 11:23:00 -0400 Subject: [PATCH] Fix #165: isenabled was misnamed and wrong --- keywords.txt | 2 +- src/Catena_Log.h | 17 ++++++++++++----- src/lib/Catena_Log.cpp | 2 +- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/keywords.txt b/keywords.txt index 88f6dbe..34be792 100644 --- a/keywords.txt +++ b/keywords.txt @@ -190,7 +190,7 @@ isReplicated KEYWORD2 isStandard KEYWORD2 isValid KEYWORD2 isbound KEYWORD2 -isenabled KEYWORD2 +isEnabled KEYWORD2 islocated KEYWORD2 locate KEYWORD2 loop KEYWORD2 diff --git a/src/Catena_Log.h b/src/Catena_Log.h index fb7200f..b98e451 100644 --- a/src/Catena_Log.h +++ b/src/Catena_Log.h @@ -71,15 +71,22 @@ class cLog this->m_uDebugFlags = uDebugFlags; } - // check whether flags are enabled ... inline for speed + // old, incorrect polarity: return false if isEnabled() is true.. + [[deprecated("use isEnabled(), check polarities; see issue #165")]] bool isenabled(DebugFlags uDebugFlags) const { - return ((uDebugFlags & this->m_uDebugFlags) == 0 && - uDebugFlags != kAlways && - uDebugFlags != kFatal); + return !this->isEnabled(uDebugFlags); + } + + // check whether flags are enabled ... inline for speed + bool isEnabled(DebugFlags uDebugFlags) const + { + return ((uDebugFlags & this->m_uDebugFlags) != 0 || + uDebugFlags == kAlways || + uDebugFlags == kFatal); } - // log + // log, using debug flags. Note that args are evaluated even if no print. void printf( DebugFlags uDebugFlags, const char *pFmt, diff --git a/src/lib/Catena_Log.cpp b/src/lib/Catena_Log.cpp index f218719..92263df 100644 --- a/src/lib/Catena_Log.cpp +++ b/src/lib/Catena_Log.cpp @@ -53,7 +53,7 @@ cLog::printf( return; // either inbound mask must be zero or must match - if (this->isenabled(uDebugFlags)) + if (! this->isEnabled(uDebugFlags)) return; char buf[128];