9.4. Logging Messages¶
The logging of messages is handled by three dedicated macros, one for each available verbosity level (see Verbosity Level):
EPROSIMA_LOG_INFO: Logs messages withLog::Kind::Infoverbosity.EPROSIMA_LOG_WARNING: Logs messages withLog::Kind::Warningverbosity.EPROSIMA_LOG_ERROR: Logs messages withLog::Kind::Errorverbosity.
Said macros take exactly two arguments, a category and a message, and produce a log entry showing the message itself plus some meta information depending on the module’s configuration (see Log Entry Specification and Log Entry).
EPROSIMA_LOG_INFO(DOCUMENTATION_CATEGORY, "This is an info message");
EPROSIMA_LOG_WARNING(DOCUMENTATION_CATEGORY, "This is an warning message");
EPROSIMA_LOG_ERROR(DOCUMENTATION_CATEGORY, "This is an error message");
There exist some old log macros used in previous versions: logInfo, logWarning and logError.
These macros are still available as long as user does not manually disable them by ENABLE_OLD_LOG_MACROS
CMake option or in-site macro ENABLE_OLD_LOG_MACROS_ before including Log module.
See section Old Log macros disable for more information.
Warning
Note that each message level is deactivated when CMake options LOG_NO_INFO, LOG_NO_WARNING or
LOG_NO_ERROR are set to ON respectively.
For more information about how to enable and disable each individual logging macro, please refer to
Disable Logging Module.