[Ns-developers] [ns3] logging
Mathieu Lacage
mathieu.lacage at sophia.inria.fr
Thu Apr 10 08:51:56 PDT 2008
On Wed, 2008-04-09 at 17:16 -0700, Mathieu Lacage wrote:
> hi,
>
> Today is not the first time I try to use unsuccessfully NS_LOG_PARAMS: I
> just seem unable to figure out what its input is expected to be (the
> fact that it is undocumented speaks volume) so, I looked at the code
> today and I am even more confused by what its behavior is supposed to
> be.
>
> I personally would have expected something like this:
>
> NS_LOG_PARAMS ("name0" << value0 << "name1" << value1 ...);
>
> to print something like this:
>
> Component:FunctionName (name0=value0, name1=value1)
Actually, to be really specific, what I expected is that we would have a
macro named NS_LOG_FUNCTION used like this:
NS_LOG_FUNCTION ("name0"<<value0<<name1<<value1);
or, if you don't care about the args,
NS_LOG_FUNCTION ();
which would be able to understand the log bits FUNCTION and PARAMS and
would generate only the function name if ((flags & (FUNCTION | PARAMS))
== FUNCTION) and both the function name and parameters if flags &
PARAMS. I suspect very strongly that this is close to what craig
originally proposed and implemented with the log levels having an
ordering relationship. Although they don't have this ordering
relationship anymore, we could trivially make NS_LOG_FUNCTION do the
above and get the same feature set.
The above would allow you to avoid duplicating the NS_LOG_FUNCTION +
NS_LOG_PARAMS macro calls which are used everywhere in tandem to leave
just one NS_LOG_FUNCTION.
result:
functionality: no loss
lines of code: great decrease
If this is felt the way to go, I have a small perl script to do the
conversion.
Mathieu
More information about the Ns-developers
mailing list