Implementation ~copy paste~ inspired by https://github.com/bitcoin/bitcoin/blob/57b34599b2deb179ff1bd97ffeab91ec9f904d85/src/leveldb/util/posix_logger.h#L28
ping @laanwj
Implementation ~copy paste~ inspired by https://github.com/bitcoin/bitcoin/blob/57b34599b2deb179ff1bd97ffeab91ec9f904d85/src/leveldb/util/posix_logger.h#L28
ping @laanwj
40+
41+ // Print the message
42+ if (p < limit) {
43+ va_list backup_ap;
44+ va_copy(backup_ap, ap);
45+ p += vsnprintf(p, limit - p, format, backup_ap);
vsnprintf
here. We’ve purged this from the code when introducing tinyformat. Wonder if we can do something based on our strprintf
. Though bridging between C varargs and C++ is likely going to be difficult, and this solution as-taken-from LevelDB should be fine. It’s just fairly ugly code and should not be taken as a hint to contributors that using system v?s?n?printf is okay in other places.
strprintf
is difficult and error prone. I do not think it is worth it.
44@@ -44,6 +45,11 @@ const std::vector<unsigned char>& GetObfuscateKey(const CDBWrapper &w);
45
46 };
47
48+class CBitcoinLogger : public leveldb::Logger {
44@@ -44,6 +45,11 @@ const std::vector<unsigned char>& GetObfuscateKey(const CDBWrapper &w);
45
46 };
47
48+class CBitcoinLevelDBLogger : public leveldb::Logger {
429@@ -430,7 +430,7 @@ std::string HelpMessage(HelpMessageMode mode)
430 strUsage += HelpMessageOpt("-limitdescendantsize=<n>", strprintf("Do not accept transactions if any ancestor would have more than <n> kilobytes of in-mempool descendants (default: %u).", DEFAULT_DESCENDANT_SIZE_LIMIT));
431 strUsage += HelpMessageOpt("-bip9params=deployment:start:end", "Use given start/end times for specified BIP9 deployment (regtest-only)");
432 }
433- std::string debugCategories = "addrman, alert, bench, cmpctblock, coindb, db, http, libevent, lock, mempool, mempoolrej, net, proxy, prune, rand, reindex, rpc, selectcoins, tor, zmq"; // Don't translate these and qt below
434+ std::string debugCategories = "addrman, alert, bench, cmpctblock, coindb, db, http, libevent, lock, mempool, mempoolrej, net, proxy, prune, rand, reindex, rpc, selectcoins, tor, zmq, leveldb"; // Don't translate these and qt below