Refactor otbMsgDevMacro and otbGenericMsgDebugMacro
What changes will be made and why they would make a better Orfeo ToolBox?
As pointed out by @lnicola lately, activating those macros by using the cmake option
OTB_SHOW_ALL_MSG_DEBUG brings dark otb into light: term starts outputing thousands of thousands of useless information. There might be something you are actually interested in in there, but good luck finding it.
There are actually 2 separate issues (apart from the fact that macros are evil):
- you need to rebuild the whole OTB with this option activated in order to get those debug information
- some parts of the code are way, way too verbose and messages are most of the time useless
High level description
I propose that we change the code of the macros to activate the prints with an environment variable. This would allow to get the verbose mode without rebuilding the whole OTB. We could even to activate those traces on a per filter basis (still with an environment variable).
I then propose to make a rigorous clean-up of the calls to those macros : 551 calls to
otbMsgDevMacro and 84 calls to
We can probably also merge those two into a single macro.
Risks and benefits
The one risk I see is that code in those macro will always be executed (to check if prints should be generated), whereas in the current case if the cmake option is OFF, code in the macro is empty. Maybe we can mitigate the possible peformance loss using something like function pointers ...
Who will be developing the proposed changes?
I can try to start something.