9.8. Disable Logging Module¶
Setting the Verbosity Level, translates into entries not being added to the log queue if the entry’s level has lower importance than the set one. This check is performed when calling the macros defined in Logging Messages. However, it is possible to fully disable each macro (and therefore each verbosity level individually) at build time.
EPROSIMA_LOG_INFOis fully disabled by either:Setting CMake option
LOG_NO_INFOtoON(default for Single-Config generators ifCMAKE_BUILD_TYPEis other thanDebug).Defining macro
HAVE_LOG_NO_INFOto1.
EPROSIMA_LOG_WARNINGis fully disabled by either:Setting CMake option
LOG_NO_WARNINGtoON.Defining macro
HAVE_LOG_NO_WARNINGto1.
EPROSIMA_LOG_ERRORis fully disabled by either:Setting CMake option
LOG_NO_ERRORtoON.Defining macro
HAVE_LOG_NO_ERRORto1.
Applying either of the previously described methods will set the macro to be empty at configuration time, thus allowing the compiler to optimize the call out. This is done so that all the debugging messages present on the library are optimized out at build time if not building for debugging purposes, thus preventing them to impact performance.
INTERNAL_DEBUG CMake option activates log macros compilation, so the arguments of the macros are compiled.
However:
It does not activate the log Warning and Error messages, i.e. the messages are not written in the log queue.
EPROSIMA_LOG_INFOhas a special behaviour to simplify working with Multi-Config capability IDEs. If CMake optionLOG_NO_INFOisOFF, or the C++ definitionHAVE_LOG_NO_INFOis0, then logging is enabled only forDebugconfiguration. In this scenario, settingFASTDDS_ENFORCE_LOG_INFOtoONwill enableEPROSIMA_LOG_INFOeven on nonDebugconfigurations. This is specially useful when using the Fast DDS’ logging module in an external application which links with Fast DDS compiled inRelease. In that case, applications wanting to use all three levels of logging can simply add the following code prior to including any Fast DDS header:#define HAVE_LOG_NO_INFO 0 #define FASTDDS_ENFORCE_LOG_INFO 1
Warning
INTERNAL_DEBUG can be automatically set to ON if CMake option EPROSIMA_BUILD is set to ON.
9.9. Old Log macros disable¶
Before version 2.8.2, Fast DDS project used log macros: logInfo, logWarning and
logError, which may collide with other libraries.
These log macros have been replaced by new ones with a more specific format: (e.g. EPROSIMA_LOG_INFO).
In order to disable old macros compilation, use CMake option ENABLE_OLD_LOG_MACROS = ON
or define ENABLE_OLD_LOG_MACROS_ 0 before including the log module
#include <fastdds/dds/log/Log.hpp>.
Warning
These macros will be deprecated in future versions of Fast DDS. The use of the new format ones is encouraged.