src: Replace std::cout with log message
Change-Id: Idf49992711b4bb4a45d8f9665963feebf3b0a887
diff --git a/src/route/fib.cpp b/src/route/fib.cpp
index 1460dbb..8b5d668 100644
--- a/src/route/fib.cpp
+++ b/src/route/fib.cpp
@@ -56,8 +56,6 @@
Fib::scheduleEntryRefreshing(const ndn::Name& name, int32_t feSeqNum,
const ndn::time::seconds& expTime)
{
- std::cout << "Fib::scheduleEntryRefreshing Called" << std::endl;
- std::cout << "Name: " << name << " Seq Num: " << feSeqNum << std::endl;
_LOG_DEBUG("Fib::scheduleEntryRefreshing Called");
_LOG_DEBUG("Name: " << name << " Seq Num: " << feSeqNum);
return m_nlsr.getScheduler().scheduleEvent(expTime,
@@ -68,15 +66,13 @@
void
Fib::refreshEntry(const ndn::Name& name, int32_t feSeqNum)
{
- std::cout << "Fib::refreshEntry Called" << std::endl;
- std::cout << "Name: " << name << " Seq Num: " << feSeqNum << std::endl;
+ _LOG_DEBUG("Fib::refreshEntry Called");
+ _LOG_DEBUG("Name: " << name << " Seq Num: " << feSeqNum);
std::list<FibEntry>::iterator it = std::find_if(m_table.begin(),
m_table.end(),
bind(&fibEntryNameCompare, _1, name));
if (it != m_table.end()) {
- std::cout << "Entry found with Seq Num: " << feSeqNum << std::endl;
if (it->getSeqNo() == feSeqNum) {
- std::cout << "Refreshing the FIB entry" << std::endl;
_LOG_DEBUG("Refreshing the FIB entry. Name: " << name);
for (std::list<NextHop>::iterator nhit =
(*it).getNexthopList().getNextHops().begin();
@@ -117,8 +113,6 @@
}
}
}
- std::cout << "Cancellling Scheduled event" << std::endl;
- std::cout << "Name: " << name << "Seq num: " << it->getSeqNo() << std::endl;
_LOG_DEBUG("Cancelling Scheduled event. Name: " << name);
cancelScheduledExpiringEvent((*it).getExpiringEventId());
m_table.erase(it);
@@ -129,7 +123,6 @@
void
Fib::update(const ndn::Name& name, NexthopList& nextHopList)
{
- std::cout << "Fib::updateFib Called" << std::endl;
_LOG_DEBUG("Fib::updateFib Called");
int startFace = 0;
int endFace = getNumberOfFacesForName(nextHopList,
@@ -160,7 +153,7 @@
}
}
else {
- std::cout << "Old FIB Entry" << std::endl;
+ _LOG_DEBUG("Old FIB Entry");
if (nextHopList.getSize() > 0) {
nextHopList.sort();
if (!it->isEqualNextHops(nextHopList)) {
@@ -184,8 +177,6 @@
ndn::time::system_clock::TimePoint expirationTimePoint = ndn::time::system_clock::now();
expirationTimePoint = expirationTimePoint + ndn::time::seconds(m_refreshTime);
it->setExpirationTimePoint(expirationTimePoint);
- std::cout << "Cancellling Scheduled event" << std::endl;
- std::cout << "Name: " << name << "Seq num: " << it->getSeqNo() << std::endl;
_LOG_DEBUG("Cancelling Scheduled event. Name: " << name);
cancelScheduledExpiringEvent(it->getExpiringEventId());
it->setSeqNo(it->getSeqNo() + 1);
@@ -207,9 +198,6 @@
_LOG_DEBUG("Fib::clean called");
for (std::list<FibEntry>::iterator it = m_table.begin(); it != m_table.end();
++it) {
- std::cout << "Cancellling Scheduled event" << std::endl;
- std::cout << "Name: " << it->getName() << "Seq num: " << it->getSeqNo() <<
- std::endl;
_LOG_DEBUG("Cancelling Scheduled event. Name: " << it->getName());
cancelScheduledExpiringEvent((*it).getExpiringEventId());
for (std::list<NextHop>::iterator nhit =
@@ -339,9 +327,8 @@
Fib::onRegistration(const ndn::nfd::ControlParameters& commandSuccessResult,
const std::string& message, const std::string& faceUri)
{
- //std::cout << message << ": " << commandSuccessResult << std::endl;
m_faceMap.update(faceUri, commandSuccessResult.getFaceId());
- m_faceMap.print();
+ m_faceMap.writeLog();
}
@@ -349,14 +336,13 @@
Fib::onSuccess(const ndn::nfd::ControlParameters& commandSuccessResult,
const std::string& message)
{
- //std::cout << message << ": " << commandSuccessResult << std::endl;
}
void
Fib::onFailure(uint32_t code, const std::string& error,
const std::string& message)
{
- std::cout << message << ": " << error << " (code: " << code << ")";
+ _LOG_DEBUG(message << ": " << error << " (code: " << code << ")");
}
void
@@ -369,14 +355,4 @@
}
}
-void
-Fib::print()
-{
- cout << "-------------------FIB-----------------------------" << endl;
- for (std::list<FibEntry>::iterator it = m_table.begin(); it != m_table.end();
- ++it) {
- cout << (*it);
- }
-}
-
} //namespace nlsr