aboutsummaryrefslogtreecommitdiff
path: root/src/util.cpp
diff options
context:
space:
mode:
authorJohn Newbery <john@johnnewbery.com>2017-04-03 13:39:11 -0400
committerJohn Newbery <john@johnnewbery.com>2017-04-10 17:05:59 -0400
commit5255aca3f42e44eb02751299e84e2cf122ed9b49 (patch)
treeb61c5e177295c186263cde1a866647c5ef25e660 /src/util.cpp
parent4d9950d3bc72d92a0ee9a33ab3b77e097eb77354 (diff)
downloadbitcoin-5255aca3f42e44eb02751299e84e2cf122ed9b49.tar.xz
[rpc] Add logging RPC
Adds an RPC to get and set currently active logging categories.
Diffstat (limited to 'src/util.cpp')
-rw-r--r--src/util.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/util.cpp b/src/util.cpp
index 5473799289..e859c8a1a4 100644
--- a/src/util.cpp
+++ b/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