add context to tcp logging
authorTom Henderson <tomh@tomh.org>
Tue, 29 Dec 2009 14:00:45 -0800
changeset 5887 50e5de0b03db
parent 5886 5d287d08dae3
child 5888 c9193222c2a4
add context to tcp logging
src/internet-stack/nsc-tcp-l4-protocol.cc
src/internet-stack/nsc-tcp-socket-impl.cc
src/internet-stack/tcp-l4-protocol.cc
src/internet-stack/tcp-socket-impl.cc
--- a/src/internet-stack/nsc-tcp-l4-protocol.cc	Tue Dec 29 11:09:54 2009 -0800
+++ b/src/internet-stack/nsc-tcp-l4-protocol.cc	Tue Dec 29 14:00:45 2009 -0800
@@ -89,6 +89,9 @@
 }
 
 
+#undef NS_LOG_APPEND_CONTEXT
+#define NS_LOG_APPEND_CONTEXT                                   \
+  if (m_node) { std::clog << Simulator::Now ().GetSeconds () << " [node " << m_node->GetId () << "] "; } 
 
 TypeId 
 NscTcpL4Protocol::GetTypeId (void)
--- a/src/internet-stack/nsc-tcp-socket-impl.cc	Tue Dec 29 11:09:54 2009 -0800
+++ b/src/internet-stack/nsc-tcp-socket-impl.cc	Tue Dec 29 14:00:45 2009 -0800
@@ -17,6 +17,9 @@
  * Author: Florian Westphal <fw@strlen.de>
  */
 
+#define NS_LOG_APPEND_CONTEXT                                   \
+  if (m_node) { std::clog << Simulator::Now ().GetSeconds () << " [node " << m_node->GetId () << "] "; } 
+
 #include "ns3/node.h"
 #include "ns3/inet-socket-address.h"
 #include "ns3/log.h"
--- a/src/internet-stack/tcp-l4-protocol.cc	Tue Dec 29 11:09:54 2009 -0800
+++ b/src/internet-stack/tcp-l4-protocol.cc	Tue Dec 29 14:00:45 2009 -0800
@@ -26,6 +26,7 @@
 
 #include "ns3/packet.h"
 #include "ns3/node.h"
+#include "ns3/simulator.h"
 #include "ns3/ipv4-route.h"
 
 #include "tcp-l4-protocol.h"
@@ -310,6 +311,9 @@
 
 //TcpL4Protocol stuff----------------------------------------------------------
 
+#undef NS_LOG_APPEND_CONTEXT
+#define NS_LOG_APPEND_CONTEXT                                   \
+  if (m_node) { std::clog << Simulator::Now ().GetSeconds () << " [node " << m_node->GetId () << "] "; } 
 
 /* see http://www.iana.org/assignments/protocol-numbers */
 const uint8_t TcpL4Protocol::PROT_NUMBER = 6;
--- a/src/internet-stack/tcp-socket-impl.cc	Tue Dec 29 11:09:54 2009 -0800
+++ b/src/internet-stack/tcp-socket-impl.cc	Tue Dec 29 14:00:45 2009 -0800
@@ -18,6 +18,8 @@
  * Author: Raj Bhattacharjea <raj.b@gatech.edu>
  */
 
+#define NS_LOG_APPEND_CONTEXT                                   \
+  if (m_node) { std::clog << Simulator::Now ().GetSeconds () << " [node " << m_node->GetId () << "] "; } 
 
 #include "ns3/abort.h"
 #include "ns3/node.h"