fw: refactor strategy logging and improve ASF probe logging
Bring strategy logging in line with format from 6bf94c0.
This should also marginally improve performance when log level is raised.
Refs: #5262, #5267
Co-authored-by: Davide Pesavento <davidepesa@gmail.com>
Change-Id: I6493b6476f3d0c6ae5562b66abfa46f6c6f4903d
diff --git a/daemon/fw/self-learning-strategy.cpp b/daemon/fw/self-learning-strategy.cpp
index 399b970..19d9d75 100644
--- a/daemon/fw/self-learning-strategy.cpp
+++ b/daemon/fw/self-learning-strategy.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -76,7 +76,7 @@
if (isNonDiscovery) { // "non-discovery" Interest
inRecordInfo->isNonDiscoveryInterest = true;
if (nexthops.empty()) { // return NACK if no matching FIB entry exists
- NFD_LOG_DEBUG("NACK non-discovery Interest=" << interest << " from=" << ingress << " noNextHop");
+ NFD_LOG_INTEREST_FROM(interest, ingress, "non-discovery no-nexthop");
lp::NackHeader nackHeader;
nackHeader.setReason(lp::NackReason::NO_ROUTE);
this->sendNack(nackHeader, ingress.face, pitEntry);
@@ -104,7 +104,7 @@
{
auto outRecord = pitEntry->getOutRecord(ingress.face);
if (outRecord == pitEntry->out_end()) {
- NFD_LOG_DEBUG("Data " << data.getName() << " from=" << ingress << " no out-record");
+ NFD_LOG_DATA_FROM(data, ingress, "no-out-record");
return;
}
@@ -132,11 +132,11 @@
SelfLearningStrategy::afterReceiveNack(const lp::Nack& nack, const FaceEndpoint& ingress,
const shared_ptr<pit::Entry>& pitEntry)
{
- NFD_LOG_DEBUG("Nack for " << nack.getInterest() << " from=" << ingress
- << " reason=" << nack.getReason());
+ NFD_LOG_NACK_FROM(nack, ingress, "");
+
if (nack.getReason() == lp::NackReason::NO_ROUTE) { // remove FIB entries
BOOST_ASSERT(this->lookupFib(*pitEntry).hasNextHops());
- NFD_LOG_DEBUG("Send NACK to all downstreams");
+ NFD_LOG_DEBUG("Send Nack to all downstreams");
this->sendNacks(nack.getHeader(), pitEntry);
renewRoute(nack.getInterest().getName(), ingress.face.getId(), 0_ms);
}
@@ -153,8 +153,7 @@
continue;
}
- NFD_LOG_DEBUG("send discovery Interest=" << interest << " from=" << inFace.getId() <<
- " to=" << outFace.getId());
+ NFD_LOG_INTEREST_FROM(interest, inFace.getId(), "send discovery to=" << outFace.getId());
auto outRecord = this->sendInterest(interest, outFace, pitEntry);
if (outRecord != nullptr) {
outRecord->insertStrategyInfo<OutRecordInfo>().first->isNonDiscoveryInterest = false;
@@ -173,8 +172,7 @@
}
Face& outFace = nexthop.getFace();
- NFD_LOG_DEBUG("send non-discovery Interest=" << interest << " from=" << inFace.getId() <<
- " to=" << outFace.getId());
+ NFD_LOG_INTEREST_FROM(interest, inFace.getId(), "send non-discovery to=" << outFace.getId());
auto outRecord = this->sendInterest(interest, outFace, pitEntry);
if (outRecord != nullptr) {
outRecord->insertStrategyInfo<OutRecordInfo>().first->isNonDiscoveryInterest = true;
@@ -198,13 +196,13 @@
auto pitEntry = pitEntryWeak.lock();
auto inFace = this->getFace(inFaceId);
if (pitEntry && inFace) {
- NFD_LOG_DEBUG("found PrefixAnnouncement=" << pa.getAnnouncedName());
+ NFD_LOG_DEBUG("Found PrefixAnnouncement=" << pa.getAnnouncedName());
data.setTag(make_shared<lp::PrefixAnnouncementTag>(lp::PrefixAnnouncementHeader(pa)));
this->sendDataToAll(data, pitEntry, *inFace);
this->setExpiryTimer(pitEntry, 0_ms);
}
else {
- NFD_LOG_DEBUG("PIT entry or Face no longer exists");
+ NFD_LOG_DEBUG("PIT entry or face no longer exists");
}
});
}