[Ns-developers] [ns3] logging proposal
Gustavo Carneiro
gjcarneiro at gmail.com
Mon Apr 14 16:20:01 PDT 2008
On 14/04/2008, Mathieu Lacage <mathieu.lacage at sophia.inria.fr> wrote:
>
> hi,
>
> The following tree: http://code.nsnam.org/mathieu/ns-3-log does a few
> changes to the ns-3-logging code:
> - adds support to trace prefix time to each log line:
> NS_LOG='Component=prefix_time|param' will output the content of
> NS_LOG_PARAMS with a time prefix.
I wish time logging would not need to be configured. This is adding even
more complexity to the logging configuration. In fact, I am going to use
this opportunity to complain about the complex logging env. variable
syntax. Each time I use a logging domain I end up using level_all, because
there are so many logging levels and this system is way too complex for
people who just want to get the job done.
My ideal logging behaviour would be:
1. Logging levels warning and upwards would be enabled by default for all
log components. Why would anyone not want to see a warning? Hiding
warnings by default is just silly IMHO;
2. When I specify NS_LOG=Component and nothing more then it should be
equivalent to NS_LOG=Component=level_all. That's what most people use
anyway, I'll bet.
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.
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;
b) or, only enable timestamps for log messages when the current
simulation time has changed since the last log message; this should not be
hard by keeping a global variable to keep track of the last logged
timestamp.
- add documentation to each macro
- remove NS_LOG_PARAMS_BEGIN/END
I don't blame you for removing these since they required too much typing and
programmers were too lazy to use them (myself included). But the fact is
that I just realized that NS_LOG_PARAMS(foo << bar) does not in fact log
"(foo=value1, bar=value2)", it just logs the values. I would love to see
the parameter names in addition to values in all log messages, but, alas,
too much typing required by the existing NS_LOG_PARAMS_BEGIN/END macros just
renders this useless :(
Does anyone knows about variadic macros?... ;-)
Thanks for the nice work so far.
--
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