mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-07 19:22:17 +01:00
[rpc] Add logging RPC
Adds an RPC to get and set currently active logging categories.
This commit is contained in:
17
src/util.cpp
17
src/util.cpp
@@ -118,7 +118,7 @@ bool fLogIPs = DEFAULT_LOGIPS;
|
||||
std::atomic<bool> fReopenDebugLog(false);
|
||||
CTranslationInterface translationInterface;
|
||||
|
||||
/** Log categories bitfield. Leveldb/libevent need special handling if their flags are changed at runtime. */
|
||||
/** Log categories bitfield. libevent needs special handling if their flags are changed at runtime. */
|
||||
std::atomic<uint32_t> logCategories(0);
|
||||
|
||||
/** Init OpenSSL library multithreading support */
|
||||
@@ -295,6 +295,21 @@ std::string ListLogCategories()
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::vector<CLogCategoryActive> ListActiveLogCategories()
|
||||
{
|
||||
std::vector<CLogCategoryActive> ret;
|
||||
for (unsigned int i = 0; i < ARRAYLEN(LogCategories); i++) {
|
||||
// Omit the special cases.
|
||||
if (LogCategories[i].flag != BCLog::NONE && LogCategories[i].flag != BCLog::ALL) {
|
||||
CLogCategoryActive catActive;
|
||||
catActive.category = LogCategories[i].category;
|
||||
catActive.active = LogAcceptCategory(LogCategories[i].flag);
|
||||
ret.push_back(catActive);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* fStartedNewLine is a state variable held by the calling context that will
|
||||
* suppress printing of the timestamp when multiple calls are made that don't
|
||||
|
||||
Reference in New Issue
Block a user