[Ns-developers] [ns3] logging proposal

Gustavo Carneiro gjcarneiro at gmail.com
Tue Apr 15 13:49:47 PDT 2008


On 15/04/2008, Mathieu Lacage <mathieu.lacage at sophia.inria.fr> wrote:
>
> gustavo,
>
> Do you have any specific suggestion as to what to do with the duplicate
> function name output when using the NS_LOG=ComponentName syntax ? The
> "easy" solution would be to run my perl script to remove NS_LOG_FUNCTION
> when it is paired with NS_LOG_PARAMS but, I have the gut feeling that
> this is ugly. Ideas ? Or do you want me to proceed with this ?


I am fine with your perl script, but I am thinking now that it is not at all
clear that NS_LOG_PARAMS also outputs the function name, besides the
parameters themselves, so the pairing of NS_LOG_PARAMS with NS_LOG_FUNCTION
is an error that is bound to occur again.

My proposal would be to get rid of the old NS_LOG_FUNCTION and rename
NS_LOG_PARAMS to NS_LOG_FUNCTION.  In this case NS_LOG_FUNCTION becomes a
function-style macro, and lines like this:

    NS_LOG_FUNCTION;

need to become like this:

    NS_LOG_FUNCTION ();

But now NS_LOG_FUNCTION optionally accepts parameters:

NS_LOG_FUNCTION (this << that);

But this way in the end we simplify things.  There's no longer "log
parameters" and "log function"; there's only "log function, optionally with
parameters".

Hope this helps.


> On Mon, 2008-04-14 at 16:40 -0700, Mathieu Lacage wrote:
> > On Mon, 2008-04-14 at 16:31 -0700, Mathieu Lacage wrote:
> >
> > > >  3. On unix systems, separating NS_LOG components by semicolon is a
> > > > PITA, because it makes me keep quoting the NS_LOG value.  It should
> be
> > > > colon separated on unix systems, semicolon on win32.
> > >
> > > Using a different syntax on different platforms is just plain
> braindead:
> > > just use a colon everywhere and be done with it.
> >
> > done.
> >
> > >
> > > >
> > > >  4. Timestamps logging should not need to be manually configured.  I
> > > > would propose one of two ways to accomplish that:
> > > >     a) enable timestamps for all log messages unconditionally;
> > >
> > > I would be fine with doing this for the NS_LOG=component syntax.
> >
> > done.
> >
> > Mathieu
> >
>
>


-- 
Gustavo J. A. M. Carneiro
INESC Porto, Telecommunications and Multimedia Unit
"The universe is always one step beyond logic." -- Frank Herbert


More information about the Ns-developers mailing list