Add macro for unconditional non-error logging
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
Currently no logging macro is available for recording important information for debugging and troubleshooting.
Debug macros could be usable, but they only log messages if debug mode is specifically enabled for an object. The problem is that usually we don't know which object's debug macros would log relevant information or the application already crashed, so it would be too late to enable debugging for all potentially involved objects. Also, current debug level logs are too detailed, more like trace level.
Warning and error macros are intended for error or potentially error cases, so they are not suitable for debug/info level logging.
We propose to add a vtkInfoMacro:
-
Allow completely disable vtkInfoMacro by an #ifdef (for example, if #ifndef VTK_INFO_ENABLED then vtkInfoMacro is an empty statement; we can set VTK_INFO_ENABLED to false by default)
-
Put the macro in a separate header, for example in a new module, such as ApplicationSupport to not make the macro visible to VTK library classes but only to tests, examples, and applications.
Notes:
-
This is an application support feature: the macro is only to be used in test, examples, and application classes (classes derived from vtkObject). They make the life of application developers easier, allow standardization, reduces code/feature duplication. There are several examples for such features in VTK, including QVTKWidget or vtkOutputWindow::DisplayText().
-
There would be no impact on VTK: the macro is not intended to be used by VTK classes and would be disabled by default by the precompiler (using #ifdef)
-
This macro is not for implementing a complete logging framework in VTK such as log4cpp. It would be just a convenient mechanism to send messages to logging frameworks from VTK.