diff --git a/include/opendht/dht_interface.h b/include/opendht/dht_interface.h index 6c51bb5e7505d1c09f031d17ca758f9004062511..bf837492c19289564c17c238776fa7043ebae8b9 100644 --- a/include/opendht/dht_interface.h +++ b/include/opendht/dht_interface.h @@ -216,7 +216,7 @@ public: */ virtual void setLoggers(LogMethod error = NOLOG, LogMethod warn = NOLOG, LogMethod debug = NOLOG) { - DHT_LOG.DEBUG = debug; + DHT_LOG.DBG = debug; DHT_LOG.WARN = warn; DHT_LOG.ERR = error; } diff --git a/include/opendht/log_enable.h b/include/opendht/log_enable.h index dac3863d4c36e53c929ae68bade4228f67d4a55c..9bbef46bc4f1cbb380c0ced1b0729432ba7d0378 100644 --- a/include/opendht/log_enable.h +++ b/include/opendht/log_enable.h @@ -85,7 +85,7 @@ private: }; struct Logger { - LogMethod DEBUG = NOLOG; + LogMethod DBG = NOLOG; LogMethod WARN = NOLOG; LogMethod ERR = NOLOG; void setFilter(const InfoHash& f) { @@ -114,7 +114,7 @@ struct Logger { #if OPENDHT_LOG va_list args; va_start(args, format); - log0(DEBUG, format, args); + log0(DBG, format, args); va_end(args); #endif } @@ -122,7 +122,7 @@ struct Logger { #if OPENDHT_LOG va_list args; va_start(args, format); - log1(DEBUG, f, format, args); + log1(DBG, f, format, args); va_end(args); #endif } @@ -130,7 +130,7 @@ struct Logger { #if OPENDHT_LOG va_list args; va_start(args, format); - log2(DEBUG, f1, f2, format, args); + log2(DBG, f1, f2, format, args); va_end(args); #endif } diff --git a/include/opendht/securedht.h b/include/opendht/securedht.h index e1049cd80a20d3bff95c4dfca92266aa7a1be083..cd01f16015edc3baf0d5061ac62056deccca042f 100644 --- a/include/opendht/securedht.h +++ b/include/opendht/securedht.h @@ -310,11 +310,9 @@ public: dht_->pushNotificationReceived(notification); } - void setLoggers(LogMethod error = NOLOG, LogMethod warn = NOLOG, LogMethod debug = NOLOG) + void setLoggers(LogMethod error = NOLOG, LogMethod warn = NOLOG, LogMethod debug = NOLOG) override { - DHT_LOG.DEBUG = debug; - DHT_LOG.WARN = warn; - DHT_LOG.ERR = error; + DhtInterface::setLoggers(error, warn, debug); dht_->setLoggers(error, warn, debug); } diff --git a/src/dht.cpp b/src/dht.cpp index dd57eb27d434a67a21e347bf0e5c493c41562d97..d62a7f4be3be77ef5e4443647bcca016d72f6361 100644 --- a/src/dht.cpp +++ b/src/dht.cpp @@ -635,7 +635,7 @@ Dht::searchStep(Sp<Search> sr) // true if this node is part of the target nodes cluter. /*bool in = sr->id.xorCmp(myid, sr->nodes.back().node->id) < 0; - DHT_LOG_DEBUG("[search %s IPv%c] synced%s", + DHT_LOG_DBG("[search %s IPv%c] synced%s", sr->id.toString().c_str(), sr->af == AF_INET ? '4' : '6', in ? ", in" : "");*/ if (not sr->listeners.empty()) { @@ -665,7 +665,7 @@ Dht::searchStep(Sp<Search> sr) i++; } while (sent and sr->currentlySolicitedNodeCount() < MAX_REQUESTED_SEARCH_NODES); - /*DHT_LOG_DEBUG("[search %s IPv%c] step: sent %u requests (total %u).", + /*DHT_LOG_DBG("[search %s IPv%c] step: sent %u requests (total %u).", sr->id.toString().c_str(), sr->af == AF_INET ? '4' : '6', i, sr->currentlySolicitedNodeCount());*/ } @@ -1776,7 +1776,7 @@ Dht::Dht(const int& s, const int& s6, Config config) bool Dht::neighbourhoodMaintenance(RoutingTable& list) { - //DHT_LOG_DEBUG("neighbourhoodMaintenance"); + //DHT_LOG_DBG("neighbourhoodMaintenance"); auto b = list.findBucket(myid); if (b == list.end()) return false; diff --git a/src/network_engine.cpp b/src/network_engine.cpp index c38a79aec4d9da9a57dcffb79e2abadf3d586cb9..f6b601c81cfa93071a6f5647b88c8a923e73fe76 100644 --- a/src/network_engine.cpp +++ b/src/network_engine.cpp @@ -419,7 +419,7 @@ NetworkEngine::processMessage(const uint8_t *buf, size_t buflen, const SockAddr& msg->msgpack_unpack(msg_res.get()); } catch (const std::exception& e) { DHT_LOG.w("Can't parse message of size %lu: %s", buflen, e.what()); - DHT_LOG.DEBUG.logPrintable(buf, buflen); + //DHT_LOG.DBG.logPrintable(buf, buflen); return; } @@ -977,7 +977,7 @@ NetworkEngine::sendNodesValues(const SockAddr& addr, Tid tid, const Blob& nodes, pk.pack(std::string("v")); pk.pack_array(st.size()*fields.size()); for (const auto& v : st) v->msgpack_pack_fields(fields, pk); - //DHT_LOG_DEBUG("sending closest nodes (%d+%d nodes.), %u value headers containing %u fields", + //DHT_LOG_DBG("sending closest nodes (%d+%d nodes.), %u value headers containing %u fields", // nodes.size(), nodes6.size(), st.size(), fields.size()); } } diff --git a/src/securedht.cpp b/src/securedht.cpp index 2fa3254f033e20ebf88a22fec57690488d5be6f6..4d173170e4e84b9c90817a894f0574fc64e7410f 100644 --- a/src/securedht.cpp +++ b/src/securedht.cpp @@ -56,7 +56,7 @@ SecureDht::SecureDht(std::unique_ptr<DhtInterface> dht, SecureDht::Config conf) 1 }, [this](bool ok) { if (ok) - DHT_LOG.DEBUG("SecureDht: public key announced successfully"); + DHT_LOG.DBG("SecureDht: public key announced successfully"); }, {}, true); } } @@ -139,7 +139,7 @@ SecureDht::registerCertificate(const InfoHash& node, const Blob& data) } InfoHash h = crt->getPublicKey().getId(); if (node == h) { - DHT_LOG.DEBUG("Registering certificate for %s", h.toString().c_str()); + DHT_LOG.DBG("Registering certificate for %s", h.toString().c_str()); auto it = nodesCertificates_.find(h); if (it == nodesCertificates_.end()) std::tie(it, std::ignore) = nodesCertificates_.emplace(h, std::move(crt)); @@ -147,7 +147,7 @@ SecureDht::registerCertificate(const InfoHash& node, const Blob& data) it->second = std::move(crt); return it->second; } else { - DHT_LOG.DEBUG("Certificate %s for node %s does not match node id !", h.toString().c_str(), node.toString().c_str()); + DHT_LOG.WARN("Certificate %s for node %s does not match node id !", h.toString().c_str(), node.toString().c_str()); return nullptr; } } @@ -164,7 +164,7 @@ SecureDht::findCertificate(const InfoHash& node, std::function<void(const Sp<cry { Sp<crypto::Certificate> b = getCertificate(node); if (b && *b) { - DHT_LOG.DEBUG("Using certificate from cache for %s", node.toString().c_str()); + DHT_LOG.DBG("Using certificate from cache for %s", node.toString().c_str()); if (cb) cb(b); return; @@ -172,7 +172,7 @@ SecureDht::findCertificate(const InfoHash& node, std::function<void(const Sp<cry if (localQueryMethod_) { auto res = localQueryMethod_(node); if (not res.empty()) { - DHT_LOG.DEBUG("Registering certificate from local store for %s", node.toString().c_str()); + DHT_LOG.DBG("Registering certificate from local store for %s", node.toString().c_str()); nodesCertificates_.emplace(node, res.front()); if (cb) cb(res.front()); @@ -187,7 +187,7 @@ SecureDht::findCertificate(const InfoHash& node, std::function<void(const Sp<cry for (const auto& v : vals) { if (auto cert = registerCertificate(node, v->data)) { *found = true; - DHT_LOG.DEBUG("Found certificate for %s", node.toString().c_str()); + DHT_LOG.DBG("Found certificate for %s", node.toString().c_str()); if (cb) cb(cert); return false; @@ -205,7 +205,7 @@ SecureDht::findPublicKey(const InfoHash& node, std::function<void(const Sp<const { auto pk = getPublicKey(node); if (pk && *pk) { - DHT_LOG.DEBUG("Found public key from cache for %s", node.toString().c_str()); + DHT_LOG.DBG("Found public key from cache for %s", node.toString().c_str()); if (cb) cb(pk); return; @@ -327,14 +327,13 @@ SecureDht::putSigned(const InfoHash& hash, Sp<Value> val, DoneCallback callback, // Check if we are already announcing a value auto p = dht_->getPut(hash, val->id); if (p && val->seq <= p->seq) { - DHT_LOG.DEBUG("Found previous value being announced."); val->seq = p->seq + 1; } // Check if data already exists on the dht get(hash, [val,this] (const std::vector<Sp<Value>>& vals) { - DHT_LOG.DEBUG("Found online previous value being announced."); + DHT_LOG.DBG("Found online previous value being announced."); for (const auto& v : vals) { if (!v->isSigned()) DHT_LOG.ERR("Existing non-signed value seems to exists at this location.");