EnablingLogging: Difference between revisions

From Nsnam
Jump to navigation Jump to search
No edit summary
 
mNo edit summary
 
Line 10: Line 10:
g++ -Wall -g -DNS3_LOG_ENABLE -o foo src/foo.cc -lns3
g++ -Wall -g -DNS3_LOG_ENABLE -o foo src/foo.cc -lns3
</pre></code>
</pre></code>
This is useful to enable/disable logging without having to edit any code.


[[Category:Samples]]
[[Category:Samples]]

Latest revision as of 16:12, 23 May 2008

A common first "gotcha" in simulation scripts, the following macro must be declared to enable logging:

  #define NS3_LOG_ENABLE

This should happen before core-module.h is included. Note that macros may be defined from the command line in gcc, e.g.:

g++ -Wall -g -DNS3_LOG_ENABLE -o foo src/foo.cc -lns3

This is useful to enable/disable logging without having to edit any code.