Skip to content

Commit

Permalink
Merge pull request #2076 from jamescowens/adjust_logging
Browse files Browse the repository at this point in the history
log: Adjust logging
  • Loading branch information
jamescowens authored Mar 29, 2021
2 parents 0e68f26 + 92f3d44 commit ca5610f
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 51 deletions.
23 changes: 12 additions & 11 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -594,13 +594,6 @@ bool AppInit2(ThreadHandlerPtr threads)
LogInstance().EnableCategory(BCLog::LogFlags::VERBOSE);
}

if (GetArg("-debug10", "false") == "true")
{
LogPrintf("Entering debug category NOISY from legacy debug mode 10.");
LogInstance().EnableCategory(BCLog::LogFlags::NOISY);
}


#if defined(WIN32)
fDaemon = false;
#else
Expand Down Expand Up @@ -711,13 +704,21 @@ bool AppInit2(ThreadHandlerPtr threads)
std::ostringstream strErrors;

fDevbuildCripple = false;
if((CLIENT_VERSION_BUILD != 0) && !fTestNet)
if ((CLIENT_VERSION_BUILD != 0) && !fTestNet)
{
fDevbuildCripple = true;
LogPrintf("WARNING: Running development version outside of testnet!\n"
"Staking and sending transactions will be disabled.");
if( (GetArg("-devbuild", "") == "override") && LogInstance().WillLogCategory(BCLog::LogFlags::VERBOSE))
if ((GetArg("-devbuild", "") == "override"))
{
LogInstance().EnableCategory(BCLog::LogFlags::VERBOSE);
fDevbuildCripple = false;
LogPrintf("WARNING: Running development version outside of testnet in override mode!\n"
"VERBOSE logging is enabled.");
}
else
{
LogPrintf("WARNING: Running development version outside of testnet!\n"
"Staking and sending transactions will be disabled.");
}
}

if (fDaemon)
Expand Down
13 changes: 5 additions & 8 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1030,14 +1030,11 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CTransaction &tx, bool* pfMissingInput
// This is done last to help prevent CPU exhaustion denial-of-service attacks.
if (!tx.ConnectInputs(txdb, mapInputs, mapUnused, CDiskTxPos(1,1,1), pindexBest, false, false))
{
if (LogInstance().WillLogCategory(BCLog::LogFlags::VERBOSE) || true)
{
return error("AcceptToMemoryPool : Unable to Connect Inputs %s", hash.ToString().c_str());
}
else
{
return false;
}
LogPrint(BCLog::LogFlags::MEMPOOL, "WARNING: %s: Unable to Connect Inputs %s.",
__func__,
hash.ToString().c_str());

return false;
}
}

Expand Down
26 changes: 0 additions & 26 deletions src/rpc/blockchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1471,32 +1471,6 @@ UniValue debug(const UniValue& params, bool fHelp)
return res;
}

UniValue debug10(const UniValue& params, bool fHelp)
{
if (fHelp || params.size() != 1)
throw runtime_error(
"debug10 <bool>\n"
"\n"
"<bool> -> Specify true or false\n"
"Enable or disable NOISY logging category (aka old debug10) on the fly\n"
"This is deprecated by the \"logging noisy\" command.\n");

UniValue res(UniValue::VOBJ);

if(params[0].get_bool())
{
LogInstance().EnableCategory(BCLog::LogFlags::NOISY);
}
else
{
LogInstance().DisableCategory(BCLog::LogFlags::NOISY);
}

res.pushKV("Logging category NOISY (aka old debug10) ", LogInstance().WillLogCategory(BCLog::LogFlags::NOISY) ? "Enabled." : "Disabled.");

return res;
}

UniValue getlistof(const UniValue& params, bool fHelp)
{
if (fHelp || params.size() != 1)
Expand Down
2 changes: 0 additions & 2 deletions src/rpc/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,6 @@ static const CRPCConvertParam vRPCConvertParams[] =
{ "auditsnapshotaccruals" , 0 },
{ "convergencereport" , 0 },
{ "debug" , 0 },
{ "debug10" , 0 },
{ "debug2" , 0 },
{ "dumpcontracts" , 2 },
{ "dumpcontracts" , 3 },
{ "getblockstats" , 0 },
Expand Down
2 changes: 0 additions & 2 deletions src/rpc/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,6 @@ static const CRPCCommand vRPCCommands[] =
{ "comparesnapshotaccrual", &comparesnapshotaccrual, cat_developer },
{ "currentcontractaverage", &currentcontractaverage, cat_developer },
{ "debug", &debug, cat_developer },
{ "debug10", &debug10, cat_developer },
{ "dumpcontracts", &dumpcontracts, cat_developer },
{ "exportstats1", &rpc_exportstats, cat_developer },
{ "getblockstats", &rpc_getblockstats, cat_developer },
Expand Down Expand Up @@ -448,7 +447,6 @@ static const CRPCCommand vRPCCommands[] =

static constexpr const char* DEPRECATED_RPCS[] {
"debug",
"debug10",
"execute" ,
"getaccount",
"getaccountaddress",
Expand Down
2 changes: 0 additions & 2 deletions src/rpc/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,6 @@ extern UniValue addkey(const UniValue& params, bool fHelp);
extern UniValue comparesnapshotaccrual(const UniValue& params, bool fHelp);
extern UniValue currentcontractaverage(const UniValue& params, bool fHelp);
extern UniValue debug(const UniValue& params, bool fHelp);
extern UniValue debug10(const UniValue& params, bool fHelp);
extern UniValue debug2(const UniValue& params, bool fHelp);
extern UniValue dumpcontracts(const UniValue& params, bool fHelp);
extern UniValue rpc_getblockstats(const UniValue& params, bool fHelp);
extern UniValue getlistof(const UniValue& params, bool fHelp);
Expand Down

0 comments on commit ca5610f

Please sign in to comment.