Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented special handling for -nodebug flag #1014

Merged
merged 2 commits into from
Apr 27, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1206,8 +1206,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
9 changes: 9 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 @@ -307,6 +308,14 @@ 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) {
if (str.size() < 6)
return 0;
else if (strncmp(str.data(), "ERROR:", 6) != 0)
return 0;
Copy link
Contributor

@psolstice psolstice Apr 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is much more elegant way to do the comparison

if (str.compare(0, 6, "ERROR:") != 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