Bug 79

Summary: Nicer logging of parameters
Product: ns-3 Reporter: Gustavo J. A. M. Carneiro <gjcarneiro>
Component: coreAssignee: ns-bugs <ns-bugs>
Status: RESOLVED FIXED    
Severity: enhancement    
Priority: P1    
Version: pre-release   
Hardware: All   
OS: All   
Attachments: patch
patch v2
patch, v3
patch v3.1 (just updated)

Description Gustavo J. A. M. Carneiro 2007-09-24 14:35:13 UTC
I have a patch that adds a NS_LOG_PARAMS (p1 << p2 << p3 ...) macro, which automatically adds __PRETTY_FUNCTION__ ( and ) around, and also adds the ", " delimiters between parameters.
Comment 1 Gustavo J. A. M. Carneiro 2007-09-24 14:35:32 UTC
Created attachment 67 [details]
patch
Comment 2 Gustavo J. A. M. Carneiro 2007-09-25 06:46:56 UTC
Created attachment 68 [details]
patch v2

This patch replaces all NS_LOG_PARAM calls with NS_LOG_PARAMS.
OK to commit?
Comment 3 Tom Henderson 2007-09-25 09:12:20 UTC
+1
Comment 4 Gustavo J. A. M. Carneiro 2007-09-26 09:56:05 UTC
Created attachment 69 [details]
patch, v3

This patch builds on the previous version and adds support for logging named parameters, like this:

  NS_LOG_PARAMS_BEGIN ();
  NS_LOG_PARAM (this);
  NS_LOG_PARAM (daddr);
  NS_LOG_PARAM (dport);
  NS_LOG_PARAM (saddr);
  NS_LOG_PARAM (sport);
  NS_LOG_PARAM (incomingInterface);
  NS_LOG_PARAMS_END ();

Which prints something like:

std::list<ns3::Ipv4EndPoint*, std::allocator<ns3::Ipv4EndPoint*> > ns3::Ipv4EndPointDemux::Lookup(ns3::Ipv4Address, uint16_t, ns3::Ipv4Address, uint16_t, ns3::Ptr<ns3::Ipv4Interface>) (this=0x60d3c0, daddr=10.1.2.1, dport=9, saddr=10.1.3.2, sport=49153, incomingInterface=0x60fbe0)
Comment 5 Gustavo J. A. M. Carneiro 2007-11-08 13:53:16 UTC
Created attachment 86 [details]
patch v3.1 (just updated)
Comment 6 Tom Henderson 2007-11-15 00:59:59 UTC
applied as changeset 1828