Bug 79 - Nicer logging of parameters
Nicer logging of parameters
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: core
pre-release
All All
: P1 enhancement
Assigned To: ns-bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-09-24 14:35 UTC by Gustavo J. A. M. Carneiro
Modified: 2007-11-15 00:59 UTC (History)
0 users

See Also:


Attachments
patch (2.82 KB, patch)
2007-09-24 14:35 UTC, Gustavo J. A. M. Carneiro
Details | Diff
patch v2 (40.08 KB, patch)
2007-09-25 06:46 UTC, Gustavo J. A. M. Carneiro
Details | Diff
patch, v3 (44.14 KB, patch)
2007-09-26 09:56 UTC, Gustavo J. A. M. Carneiro
Details | Diff
patch v3.1 (just updated) (43.03 KB, patch)
2007-11-08 13:53 UTC, Gustavo J. A. M. Carneiro
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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