aboutsummaryrefslogtreecommitdiff
path: root/src/timedata.cpp
diff options
context:
space:
mode:
authorGregory Maxwell <greg@xiph.org>2016-12-25 20:19:40 +0000
committerGregory Maxwell <greg@xiph.org>2017-04-01 18:53:29 +0000
commit6b3bb3d9bae730d26ddd561b93efc667f5c8d499 (patch)
treead62375c446fb8ab80b1d39386a5266d610b7611 /src/timedata.cpp
parent351d0ad40495d1d2a2400af4d2cc975863258d3f (diff)
downloadbitcoin-6b3bb3d9bae730d26ddd561b93efc667f5c8d499.tar.xz
Change LogAcceptCategory to use uint32_t rather than sets of strings.
This changes the logging categories to boolean flags instead of strings. This simplifies the acceptance testing by avoiding accessing a scoped static thread local pointer to a thread local set of strings. It eliminates the only use of boost::thread_specific_ptr outside of lockorder debugging. This change allows log entries to be directed to multiple categories and makes it easy to change the logging flags at runtime (e.g. via an RPC, though that isn't done by this commit.) It also eliminates the fDebug global. Configuration of unknown logging categories now produces a warning.
Diffstat (limited to 'src/timedata.cpp')
-rw-r--r--src/timedata.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/timedata.cpp b/src/timedata.cpp
index 2ff6437c73..ec74912703 100644
--- a/src/timedata.cpp
+++ b/src/timedata.cpp
@@ -58,7 +58,7 @@ void AddTimeData(const CNetAddr& ip, int64_t nOffsetSample)
// Add data
static CMedianFilter<int64_t> vTimeOffsets(BITCOIN_TIMEDATA_MAX_SAMPLES, 0);
vTimeOffsets.input(nOffsetSample);
- LogPrint("net","added time data, samples %d, offset %+d (%+d minutes)\n", vTimeOffsets.size(), nOffsetSample, nOffsetSample/60);
+ LogPrint(BCLog::NET,"added time data, samples %d, offset %+d (%+d minutes)\n", vTimeOffsets.size(), nOffsetSample, nOffsetSample/60);
// There is a known issue here (see issue #4521):
//
@@ -108,11 +108,14 @@ void AddTimeData(const CNetAddr& ip, int64_t nOffsetSample)
}
}
}
-
- BOOST_FOREACH(int64_t n, vSorted)
- LogPrint("net", "%+d ", n);
- LogPrint("net", "| ");
-
- LogPrint("net", "nTimeOffset = %+d (%+d minutes)\n", nTimeOffset, nTimeOffset/60);
+
+ if (LogAcceptCategory(BCLog::NET)) {
+ BOOST_FOREACH(int64_t n, vSorted) {
+ LogPrint(BCLog::NET, "%+d ", n);
+ }
+ LogPrint(BCLog::NET, "| ");
+
+ LogPrint(BCLog::NET, "nTimeOffset = %+d (%+d minutes)\n", nTimeOffset, nTimeOffset/60);
+ }
}
}