Skip to content

Commit

Permalink
Implemented special handling for -nodebug flag (#1014)
Browse files Browse the repository at this point in the history
* Implemented special handling for -nodebug flag
  • Loading branch information
a-bezrukov authored Apr 27, 2021
1 parent e0bc12b commit 2ec9860
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1207,8 +1207,10 @@ bool AppInitParameterInteraction()
// Special-case: if -debug=0/-nodebug is set, turn off debugging messages
if (fDebug) {
const std::vector<std::string>& categories = mapMultiArgs.at("-debug");
if (GetBoolArg("-nodebug", false) || find(categories.begin(), categories.end(), std::string("0")) != categories.end())
if (GetBoolArg("-nodebug", false) || find(categories.begin(), categories.end(), std::string("0")) != categories.end()) {
fDebug = false;
fNoDebug = true;
}
}

// Check for -debugnet
Expand Down
5 changes: 5 additions & 0 deletions src/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ const map<string, vector<string> >& mapMultiArgs = _mapMultiArgs;
bool fDebug = false;
bool fPrintToConsole = false;
bool fPrintToDebugLog = true;
bool fNoDebug = false; //A temporary fix for https://github.com/firoorg/firo/issues/1011

bool fLogTimestamps = DEFAULT_LOGTIMESTAMPS;
bool fLogTimeMicros = DEFAULT_LOGTIMEMICROS;
Expand Down Expand Up @@ -308,6 +309,10 @@ static std::string LogTimestampStr(const std::string &str, std::atomic_bool *fSt

int LogPrintStr(const std::string &str)
{
//A temporary fix for https://github.com/firoorg/firo/issues/1011
if (fNoDebug && str.compare(0, 6, "ERROR:", 0, 6) != 0)
return 0;

int ret = 0; // Returns total number of characters written
static std::atomic_bool fStartedNewLine(true);

Expand Down
1 change: 1 addition & 0 deletions src/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ extern const std::map<std::string, std::vector<std::string> >& mapMultiArgs;
extern bool fDebug;
extern bool fPrintToConsole;
extern bool fPrintToDebugLog;
extern bool fNoDebug;

extern bool fLogTimestamps;
extern bool fLogTimeMicros;
Expand Down

0 comments on commit 2ec9860

Please sign in to comment.