[Ns-bugs] [Bug 1082] LogComponentEnable() does not provide error handling
code at nsnam.ece.gatech.edu
Sun Mar 27 18:22:41 PDT 2011
--- Comment #2 from Anirudh <sk.anirudh at gmail.com> 2011-03-27 21:22:41 EDT ---
(In reply to comment #1)
> (In reply to comment #0)
> > Created attachment 1052 [details]
> > Patch to add error handling if component name is misspelt in
> > LogComponentEnable()
> > LogComponentEnable(string ComponentName) which is defined in
> > src/core/model/log.cc in the current ns-3-dev trunk does not provide
> > appropriate error handling when ComponentName is misspelt.
> > s not give any indication to the user
> > that the name is misspelt. Instead, it continues running as usual and produces
> > no log output. This could be easily confused with the desired log component not
> > producing any output in the simulation while it is in reality not producing
> > output because ComponentName has been misspelt.
> > I have attached a patch to fix this. I think it would be useful for this to be
> > integrated in the tree even though it is a very small fix, because logging is
> > an important part of debugging.
> In general, I agree with what you are trying to do. My concerns here are,
> first, that FATAL_ERROR seems a bit drastic since this will not result in
> incorrect program output. Could you not just use NS_LOG_UNCOND here and
> achieve the same result? Second, we want to make sure that the same behavior
> is provided when the NS_LOG environmental variable is used. so probably
> something similar needs to be done to LogComponent::EnvVarCheck ().
Ok. Would it make sense to stall the program then by :
1. Displaying that the desired component name does not exist.
2. Prompting the user for a yes and no as to whether he wants to continue?
I am concerned that using NS_LOG_UNCOND would print an error message out saying
"Component not found." But this line would probably go unnoticed in the midst
of a lot of other logging output from the simulator.
Regarding the environmental variable aspect, I 'll fix that in the appropriate
function and attach a new patch.
Configure bugmail: http://www.nsnam.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the Ns-bugs