src: Replace std::cout with log message

Change-Id: Idf49992711b4bb4a45d8f9665963feebf3b0a887
diff --git a/src/route/face-map.cpp b/src/route/face-map.cpp
new file mode 100644
index 0000000..7251fc5
--- /dev/null
+++ b/src/route/face-map.cpp
@@ -0,0 +1,44 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014  University of Memphis,
+ *                     Regents of the University of California
+ *
+ * This file is part of NLSR (Named-data Link State Routing).
+ * See AUTHORS.md for complete list of NLSR authors and contributors.
+ *
+ * NLSR is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NLSR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NLSR, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * \author A K M Mahmudul Hoque <ahoque1@memphis.edu>
+ *
+ **/
+#include <iostream>
+#include <list>
+#include <utility>
+#include "logger.hpp"
+#include "face-map.hpp"
+
+namespace nlsr {
+
+INIT_LOGGER("FaceMap");
+
+void
+FaceMap::writeLog()
+{
+  _LOG_DEBUG("------- Face Map-----------");
+  for(std::list<FaceMapEntry>::iterator it = m_table.begin();
+      it != m_table.end(); ++it) {
+    _LOG_DEBUG("Face Map Entry (FaceUri: " << (*it).getFaceUri() << " Face Id: "
+               << (*it).getFaceId() << ")");
+  }
+}
+
+} // namespace NLSR
diff --git a/src/route/face-map.hpp b/src/route/face-map.hpp
index 2225446..4bc2b68 100644
--- a/src/route/face-map.hpp
+++ b/src/route/face-map.hpp
@@ -23,6 +23,8 @@
 #ifndef NLSR_FACE_MAP_HPP
 #define NLSR_FACE_MAP_HPP
 
+#include <ndn-cxx/common.hpp>
+
 namespace nlsr {
 
 class FaceMapEntry {
@@ -69,14 +71,6 @@
   uint32_t m_faceId;
 };
 
-inline std::ostream&
-operator<<(std::ostream& os, const FaceMapEntry& fme)
-{
-  os << "Face Map Entry (FaceUri: " << fme.getFaceUri() << " Face Id: ";
-  os << fme.getFaceId() << ")" << std::endl;
-  return os;
-}
-
 class FaceMap {
 
 public:
@@ -118,15 +112,8 @@
     return 0;
   }
 
-  inline void
-  print()
-  {
-    std::cout << "------- Face Map-----------" << std::endl;
-    for(std::list<FaceMapEntry>::iterator it = m_table.begin();
-        it != m_table.end(); ++it) {
-          std::cout << (*it);
-    }
-  }
+  void
+  writeLog();
 
 private:
   std::list<FaceMapEntry> m_table;
diff --git a/src/route/fib-entry.cpp b/src/route/fib-entry.cpp
index aacb0a3..a7eb68f 100644
--- a/src/route/fib-entry.cpp
+++ b/src/route/fib-entry.cpp
@@ -64,13 +64,4 @@
   m_nexthopList.writeLog();
 }
 
-ostream&
-operator<<(ostream& os, FibEntry fe)
-{
-  os << "Name Prefix: " << fe.getName() << endl;
-  os << "Time to Refresh: " << fe.getExpirationTimePoint() << endl;
-  os << fe.getNexthopList() << endl;
-  return os;
-}
-
 }//namespace nlsr
diff --git a/src/route/fib-entry.hpp b/src/route/fib-entry.hpp
index 5465ec9..7f39fdd 100644
--- a/src/route/fib-entry.hpp
+++ b/src/route/fib-entry.hpp
@@ -116,9 +116,6 @@
   NexthopList m_nexthopList;
 };
 
-std::ostream&
-operator<<(std::ostream& os, FibEntry fe);
-
 } //namespace nlsr
 
 #endif //NLSR_FIB_ENTRY_HPP
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
diff --git a/src/route/fib.hpp b/src/route/fib.hpp
index b44c86d..9ffd44c 100644
--- a/src/route/fib.hpp
+++ b/src/route/fib.hpp
@@ -66,9 +66,6 @@
     m_refreshTime = fert;
   }
 
-  void
-  print();
-
 private:
   void
   removeHop(NexthopList& nl, const std::string& doNotRemoveHopFaceUri,
diff --git a/src/route/map-entry.hpp b/src/route/map-entry.hpp
index f2ba05d..f3779e9 100644
--- a/src/route/map-entry.hpp
+++ b/src/route/map-entry.hpp
@@ -64,14 +64,6 @@
   int32_t m_mappingNumber;
 };
 
-inline std::ostream&
-operator<<(std::ostream& os, const MapEntry& mpe)
-{
-  os << "MapEntry: ( Router: " << mpe.getRouter() << " Mapping No: ";
-  os << mpe.getMappingNumber() << " )" << std::endl;
-  return os;
-}
-
 } // namespace nlsr
 
 #endif // NLSR_MAP_ENTRY_HPP
diff --git a/src/route/map.cpp b/src/route/map.cpp
index 65d004f..a34f415 100644
--- a/src/route/map.cpp
+++ b/src/route/map.cpp
@@ -28,9 +28,11 @@
 #include "lsa.hpp"
 #include "lsdb.hpp"
 #include "map.hpp"
-
+#include "logger.hpp"
 namespace nlsr {
 
+INIT_LOGGER("Map");
+
 using namespace std;
 
 static bool
@@ -117,15 +119,14 @@
   m_mappingIndex = 0;
 }
 
-ostream&
-operator<<(ostream& os, Map& map)
+void
+Map::writeLog()
 {
-  os << "---------------Map----------------------" << endl;
-  std::list<MapEntry> ml = map.getMapList();
-  for (std::list<MapEntry>::iterator it = ml.begin(); it != ml.end() ; it++) {
-    os << (*it);
+  _LOG_DEBUG("---------------Map----------------------");
+  for (std::list<MapEntry>::iterator it = m_table.begin(); it != m_table.end() ; it++) {
+    _LOG_DEBUG("MapEntry: ( Router: " << (*it).getRouter() << " Mapping No: "
+               << (*it).getMappingNumber() << " )");
   }
-  return os;
 }
 
 } //namespace nlsr
diff --git a/src/route/map.hpp b/src/route/map.hpp
index 09cdeee..8f7d0f4 100644
--- a/src/route/map.hpp
+++ b/src/route/map.hpp
@@ -71,6 +71,8 @@
     return m_table.size();
   }
 
+  void
+  writeLog();
 
 private:
   bool
@@ -80,8 +82,5 @@
   std::list<MapEntry> m_table;
 };
 
-std::ostream&
-operator<<(std::ostream& os, Map& map);
-
 } // namespace nlsr
 #endif //NLSR_MAP_HPP
diff --git a/src/route/name-prefix-table-entry.cpp b/src/route/name-prefix-table-entry.cpp
index 80008ff..1d20319 100644
--- a/src/route/name-prefix-table-entry.cpp
+++ b/src/route/name-prefix-table-entry.cpp
@@ -103,18 +103,4 @@
   m_nexthopList.writeLog();
 }
 
-//debugging purpose
-ostream&
-operator<<(ostream& os, NamePrefixTableEntry& npte)
-{
-  os << "Name: " << npte.getNamePrefix() << endl;
-  std::list<RoutingTableEntry> rteList = npte.getRteList();
-  for (std::list<RoutingTableEntry>::iterator it = rteList.begin();
-       it != rteList.end(); ++it) {
-    cout << (*it);
-  }
-  os << npte.getNexthopList();
-  return os;
-}
-
 }//namespace nlsr
diff --git a/src/route/name-prefix-table-entry.hpp b/src/route/name-prefix-table-entry.hpp
index ee8df2b..9b25f5e 100644
--- a/src/route/name-prefix-table-entry.hpp
+++ b/src/route/name-prefix-table-entry.hpp
@@ -97,9 +97,6 @@
   NexthopList m_nexthopList;
 };
 
-std::ostream&
-operator<<(std::ostream& os, NamePrefixTableEntry& npte);
-
 }//namespace nlsr
 
 #endif //NLSR_NAME_PREFIX_TABLE_ENTRY_HPP
diff --git a/src/route/name-prefix-table.cpp b/src/route/name-prefix-table.cpp
index 582c01d..d9c63e4 100644
--- a/src/route/name-prefix-table.cpp
+++ b/src/route/name-prefix-table.cpp
@@ -164,15 +164,4 @@
   }
 }
 
-void
-NamePrefixTable::print()
-{
-  std::cout << "----------------NPT----------------------" << std::endl;
-  for (std::list<NamePrefixTableEntry>::iterator it = m_table.begin();
-       it != m_table.end();
-       ++it) {
-    cout << (*it) << endl;
-  }
-}
-
 } //namespace nlsr
diff --git a/src/route/name-prefix-table.hpp b/src/route/name-prefix-table.hpp
index 2596174..fb36ffb 100644
--- a/src/route/name-prefix-table.hpp
+++ b/src/route/name-prefix-table.hpp
@@ -52,9 +52,6 @@
   void
   writeLog();
 
-  void
-  print();
-
 private:
   void
   addEntry(const ndn::Name& name, RoutingTableEntry& rte);
diff --git a/src/route/nexthop-list.cpp b/src/route/nexthop-list.cpp
index 07b7d1f..6159563 100644
--- a/src/route/nexthop-list.cpp
+++ b/src/route/nexthop-list.cpp
@@ -105,16 +105,4 @@
   }
 }
 
-ostream&
-operator<<(ostream& os, NexthopList& nhl)
-{
-  std::list<NextHop> nexthopList = nhl.getNextHops();
-  int i = 1;
-  for (std::list<NextHop>::iterator it = nexthopList.begin();
-       it != nexthopList.end() ; it++, i++) {
-    os << "Nexthop " << i << ": " << (*it) << endl;
-  }
-  return os;
-}
-
 }//namespace nlsr
diff --git a/src/route/nexthop-list.hpp b/src/route/nexthop-list.hpp
index e358166..c34400d 100644
--- a/src/route/nexthop-list.hpp
+++ b/src/route/nexthop-list.hpp
@@ -79,9 +79,6 @@
   std::list<NextHop> m_nexthopList;
 };
 
-std::ostream&
-operator<<(std::ostream& os, NexthopList& nhl);
-
 }//namespace nlsr
 
 #endif //NLSR_NEXTHOP_LIST_HPP
diff --git a/src/route/nexthop.hpp b/src/route/nexthop.hpp
index 097230f..ecd84fa 100644
--- a/src/route/nexthop.hpp
+++ b/src/route/nexthop.hpp
@@ -71,15 +71,6 @@
   double m_routeCost;
 };
 
-
-inline std::ostream&
-operator<<(std::ostream& os, const NextHop& nh)
-{
-  os << "Face: " << nh.getConnectingFaceUri() << "  Route Cost: " <<
-     nh.getRouteCost();
-  return os;
-}
-
 }//namespace nlsr
 
 #endif //NLSR_NEXTHOP_HPP
diff --git a/src/route/routing-table-calculator.cpp b/src/route/routing-table-calculator.cpp
index 63147a5..1c39d51 100644
--- a/src/route/routing-table-calculator.cpp
+++ b/src/route/routing-table-calculator.cpp
@@ -28,9 +28,11 @@
 #include "lsa.hpp"
 #include "nexthop.hpp"
 #include "nlsr.hpp"
+#include "logger.hpp"
 
 namespace nlsr {
 
+INIT_LOGGER("RoutingTableCalculator");
 using namespace std;
 
 void
@@ -72,13 +74,15 @@
 }
 
 void
-RoutingTableCalculator::printAdjMatrix()
+RoutingTableCalculator::writeAdjMatrixLog()
 {
   for (int i = 0; i < numOfRouter; i++) {
+    string line="";
     for (int j = 0; j < numOfRouter; j++) {
-      printf("%f ", adjMatrix[i][j]);
+      line += boost::lexical_cast<std::string>(adjMatrix[i][j]);
+      line += " ";
     }
-    printf("\n");
+    _LOG_DEBUG(line);
   }
 }
 
@@ -159,22 +163,18 @@
 LinkStateRoutingTableCalculator::calculatePath(Map& pMap,
                                                RoutingTable& rt, Nlsr& pnlsr)
 {
-  std::cout << "LinkStateRoutingTableCalculator::calculatePath Called" <<
-            std::endl;
+  _LOG_DEBUG("LinkStateRoutingTableCalculator::calculatePath Called");
   allocateAdjMatrix();
   initMatrix();
   makeAdjMatrix(pnlsr, pMap);
-  std::cout << pMap;
-  printAdjMatrix();
+  //printAdjMatrix();
+  writeAdjMatrixLog();
   int sourceRouter = pMap.getMappingNoByRouterName(pnlsr.getConfParameter().getRouterPrefix());
-  //int noLink=getNumOfLinkfromAdjMatrix(sourceRouter);
   allocateParent();
   allocateDistance();
   if (pnlsr.getConfParameter().getMaxFacesPerPrefix() == 1) {
     // Single Path
     doDijkstraPathCalculation(sourceRouter);
-    // print all ls path -- debugging purpose
-    printAllLsPath(sourceRouter);
     // update routing table
     addAllLsNextHopsToRoutingTable(pnlsr, rt, pMap, sourceRouter);
   }
@@ -186,10 +186,8 @@
     getLinksFromAdjMatrix(links, linkCosts, sourceRouter);
     for (int i = 0 ; i < vNoLink; i++) {
       adjustAdMatrix(sourceRouter, links[i], linkCosts[i]);
-      printAdjMatrix();
+      writeAdjMatrixLog();
       doDijkstraPathCalculation(sourceRouter);
-      // print all ls path -- debugging purpose
-      printAllLsPath(sourceRouter);
       //update routing table
       addAllLsNextHopsToRoutingTable(pnlsr, rt, pMap, sourceRouter);
     }
@@ -243,8 +241,7 @@
 LinkStateRoutingTableCalculator::addAllLsNextHopsToRoutingTable(Nlsr& pnlsr,
                                                                 RoutingTable& rt, Map& pMap, int sourceRouter)
 {
-  std::cout <<
-            "LinkStateRoutingTableCalculator::addAllNextHopsToRoutingTable Called";
+  _LOG_DEBUG("LinkStateRoutingTableCalculator::addAllNextHopsToRoutingTable Called");
   std::cout << std::endl;
   int nextHopRouter = 0;
   for (int i = 0; i < numOfRouter ; i++) {
@@ -255,11 +252,6 @@
         ndn::Name nextHopRouterName = pMap.getRouterNameByMappingNo(nextHopRouter);
         std::string nextHopFace =
           pnlsr.getAdjacencyList().getAdjacent(nextHopRouterName).getConnectingFaceUri();
-        std::cout << "Dest Router: " << pMap.getRouterNameByMappingNo(i) << std::endl;
-        std::cout << "Next hop Router: " << nextHopRouterName << std::endl;
-        std::cout << "Next hop Face: " << nextHopFace << std::endl;
-        std::cout << "Route Cost: " << routeCost << std::endl;
-        std::cout << std::endl;
         // Add next hop to routing table
         NextHop nh(nextHopFace, routeCost);
         rt.addNextHop(pMap.getRouterNameByMappingNo(i), nh);
@@ -283,31 +275,9 @@
 }
 
 void
-LinkStateRoutingTableCalculator::printAllLsPath(int sourceRouter)
-{
-  std::cout << "LinkStateRoutingTableCalculator::printAllLsPath Called" <<
-            std::endl;
-  std::cout << "Source Router: " << sourceRouter << std::endl;
-  for (int i = 0; i < numOfRouter ; i++) {
-    if (i != sourceRouter) {
-      printLsPath(i);
-      std::cout << std::endl;
-    }
-  }
-}
-
-void
-LinkStateRoutingTableCalculator::printLsPath(int destRouter)
-{
-  if (m_parent[destRouter] != EMPTY_PARENT) {
-    printLsPath(m_parent[destRouter]);
-  }
-  std:: cout << " " << destRouter;
-}
-
-void
 LinkStateRoutingTableCalculator::sortQueueByDistance(int* Q,
-                                                     double* dist, int start, int element)
+                                                     double* dist,
+                                                     int start, int element)
 {
   for (int i = start ; i < element ; i++) {
     for (int j = i + 1; j < element; j++) {
@@ -364,6 +334,7 @@
                                          RoutingTable& rt, Nlsr& pnlsr)
 {
   makeAdjMatrix(pnlsr, pMap);
+  //std::cout << pMap;
   ndn::Name routerName = pnlsr.getConfParameter().getRouterPrefix();
   int sourceRouter = pMap.getMappingNoByRouterName(routerName);
   int noLink = getNumOfLinkfromAdjMatrix(sourceRouter);
diff --git a/src/route/routing-table-calculator.hpp b/src/route/routing-table-calculator.hpp
index e03b21e..3f1b53f 100644
--- a/src/route/routing-table-calculator.hpp
+++ b/src/route/routing-table-calculator.hpp
@@ -52,9 +52,12 @@
 
   void
   makeAdjMatrix(Nlsr& pnlsr, Map pMap);
-
+/*
   void
   printAdjMatrix();
+*/
+  void
+  writeAdjMatrixLog();
 
   int
   getNumOfLinkfromAdjMatrix(int sRouter);
@@ -123,12 +126,6 @@
   isNotExplored(int* Q, int u, int start, int element);
 
   void
-  printAllLsPath(int sourceRouter);
-
-  void
-  printLsPath(int destRouter);
-
-  void
   addAllLsNextHopsToRoutingTable(Nlsr& pnlsr, RoutingTable& rt,
                                  Map& pMap, int sourceRouter);
 
diff --git a/src/route/routing-table-entry.hpp b/src/route/routing-table-entry.hpp
index d0636e8..aa351ac 100644
--- a/src/route/routing-table-entry.hpp
+++ b/src/route/routing-table-entry.hpp
@@ -62,20 +62,6 @@
   NexthopList m_nexthopList;
 };
 
-inline std::ostream&
-operator<<(std::ostream& os, RoutingTableEntry& rte)
-{
-  os << "Destination: " << rte.getDestination() << std::endl;
-  os << "Nexthops: " << std::endl;
-  int32_t i = 1;
-  std::list<NextHop> nhl = rte.getNexthopList().getNextHops();
-  for (std::list<NextHop>::iterator it = nhl.begin();
-       it != nhl.end() ; it++, i++) {
-    os << "  Nexthop " << i << ": " << (*it) << std::endl;
-  }
-  return os;
-}
-
 } //namespace nlsr
 
 #endif //NLSR_ROUTING_TABLE_ENTRY_HPP
diff --git a/src/route/routing-table.cpp b/src/route/routing-table.cpp
index 6d632f4..613371f 100644
--- a/src/route/routing-table.cpp
+++ b/src/route/routing-table.cpp
@@ -42,11 +42,9 @@
 void
 RoutingTable::calculate(Nlsr& pnlsr)
 {
-  //debugging purpose
-  pnlsr.getNamePrefixTable().print();
-  pnlsr.getLsdb().printAdjLsdb();
-  pnlsr.getLsdb().printCorLsdb();
-  pnlsr.getLsdb().printNameLsdb();
+  pnlsr.getLsdb().writeCorLsdbLog();
+  pnlsr.getLsdb().writeNameLsdbLog();
+  pnlsr.getLsdb().writeAdjLsdbLog();
   pnlsr.getNamePrefixTable().writeLog();
   if (pnlsr.getIsRoutingTableCalculating() == false) {
     //setting routing table calculation
@@ -55,7 +53,6 @@
           pnlsr.getConfParameter().getRouterPrefix().toUri() + "/" + "adjacency",
           std::string("adjacency"))) {
       if (pnlsr.getIsBuildAdjLsaSheduled() != 1) {
-        std::cout << "CLearing old routing table ....." << std::endl;
         _LOG_DEBUG("CLearing old routing table .....");
         clearRoutingTable();
         // for dry run options
@@ -74,37 +71,25 @@
           calculateHypDryRoutingTable(pnlsr);
         }
         //need to update NPT here
+        _LOG_DEBUG("Calling Update NPT With new Route");
         pnlsr.getNamePrefixTable().updateWithNewRoute();
-        //debugging purpose
-        printRoutingTable();
-        pnlsr.getNamePrefixTable().print();
-        pnlsr.getFib().print();
         writeLog();
         pnlsr.getNamePrefixTable().writeLog();
         pnlsr.getFib().writeLog();
-        //debugging purpose end
       }
       else {
-        std::cout << "Adjacency building is scheduled, so ";
-        std::cout << "routing table can not be calculated :(" << std::endl;
         _LOG_DEBUG("Adjacency building is scheduled, so"
                    " routing table can not be calculated :(");
       }
     }
     else {
-      std::cout << "No Adj LSA of router itself,";
-      std::cout <<	" so Routing table can not be calculated :(" << std::endl;
       _LOG_DEBUG("No Adj LSA of router itself,"
                  " so Routing table can not be calculated :(");
       clearRoutingTable();
       clearDryRoutingTable(); // for dry run options
       // need to update NPT here
-      std::cout << "Calling Update NPT With new Route" << std::endl;
+      _LOG_DEBUG("Calling Update NPT With new Route");
       pnlsr.getNamePrefixTable().updateWithNewRoute();
-      //debugging purpose
-      printRoutingTable();
-      pnlsr.getNamePrefixTable().print();
-      pnlsr.getFib().print();
       writeLog();
       pnlsr.getNamePrefixTable().writeLog();
       pnlsr.getFib().writeLog();
@@ -122,9 +107,10 @@
 void
 RoutingTable::calculateLsRoutingTable(Nlsr& pnlsr)
 {
-  std::cout << "RoutingTable::calculateLsRoutingTable Called" << std::endl;
+  _LOG_DEBUG("RoutingTable::calculateLsRoutingTable Called");
   Map vMap;
   vMap.createFromAdjLsdb(pnlsr);
+  vMap.writeLog();
   int numOfRouter = vMap.getMapSize();
   LinkStateRoutingTableCalculator lsrtc(numOfRouter);
   lsrtc.calculatePath(vMap, ndn::ref(*this), pnlsr);
@@ -135,6 +121,7 @@
 {
   Map vMap;
   vMap.createFromAdjLsdb(pnlsr);
+  vMap.writeLog();
   int numOfRouter = vMap.getMapSize();
   HypRoutingTableCalculator hrtc(numOfRouter, 0);
   hrtc.calculatePath(vMap, ndn::ref(*this), pnlsr);
@@ -145,6 +132,7 @@
 {
   Map vMap;
   vMap.createFromAdjLsdb(pnlsr);
+  vMap.writeLog();
   int numOfRouter = vMap.getMapSize();
   HypRoutingTableCalculator hrtc(numOfRouter, 1);
   hrtc.calculatePath(vMap, ndn::ref(*this), pnlsr);
@@ -207,17 +195,6 @@
   }
 }
 
-void
-RoutingTable::printRoutingTable()
-{
-  std::cout << "---------------Routing Table------------------" << std::endl;
-  for (std::list<RoutingTableEntry>::iterator it = m_rTable.begin() ;
-       it != m_rTable.end(); ++it) {
-    std::cout << (*it) << std::endl;
-  }
-}
-
-
 //function related to manipulation of dry routing table
 void
 RoutingTable::addNextHopToDryTable(const ndn::Name& destRouter, NextHop& nh)
@@ -237,17 +214,6 @@
 }
 
 void
-RoutingTable::printDryRoutingTable()
-{
-  std::cout << "--------Dry Run's Routing Table--------------" << std::endl;
-  for (std::list<RoutingTableEntry>::iterator it = m_dryTable.begin() ;
-       it != m_dryTable.end(); ++it) {
-    cout << (*it) << endl;
-  }
-}
-
-
-void
 RoutingTable::clearRoutingTable()
 {
   if (m_rTable.size() > 0) {
diff --git a/src/route/routing-table.hpp b/src/route/routing-table.hpp
index ecf26c9..952a07e 100644
--- a/src/route/routing-table.hpp
+++ b/src/route/routing-table.hpp
@@ -49,14 +49,8 @@
   addNextHop(const ndn::Name& destRouter, NextHop& nh);
 
   void
-  printRoutingTable();
-
-  void
   addNextHopToDryTable(const ndn::Name& destRouter, NextHop& nh);
 
-  void
-  printDryRoutingTable();
-
   RoutingTableEntry*
   findRoutingTableEntry(const ndn::Name& destRouter);