Logging macros.
More...
|
#define | CUTEHMI_DEBUG(EXPR) qCDebug(loggingCategory()).nospace().noquote() << EXPR |
|
#define | CUTEHMI_INFO(EXPR) qCInfo(loggingCategory()).nospace().noquote() << EXPR |
|
#define | CUTEHMI_WARNING(EXPR) qCWarning(loggingCategory()).nospace().noquote() << EXPR |
|
#define | CUTEHMI_CRITICAL(EXPR) qCCritical(loggingCategory()).nospace().noquote() << EXPR |
|
#define | CUTEHMI_DIE(...) QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, loggingCategory().categoryName()).fatal(__VA_ARGS__) |
|
#define | CUTEHMI_ASSERT(EXPR, MSG) Q_ASSERT_X(EXPR, __FILE__, MSG) |
|
Logging macros.
Convenient macros to log messages with Qt logging categories. These macros can be used by other modules providing that they implement loggingCategory() function in their own namespace. This function should return QLoggingCategory object, which is declared and defined with Q_DECLARE_LOGGING_CATEGORY and Q_LOGGING_CATEGORY macros, as described in Qt documentation. Macros are corresponding to Qt debug streams.
- CUTEHMI_DEBUG - debug message (qCDebug()).
- CUTEHMI_INFO - informative message (qCInfo()).
- CUTEHMI_WARNING - informative message (qCWarning()).
- CUTEHMI_CRITICAL - informative message (qCCritical()).
There's no CUTEHMI_FATAL, because Qt (5.12) does not provide QDebug output stream for fatal errors. Instead CUTEHMI_DIE macro can be used. Unlike the other logging macros CUTEHMI_DIE does not wrap QDebug output stream, so a formatted string should be passed as macro argument (see QMessageLogger::fatal()).
◆ CUTEHMI_ASSERT
#define CUTEHMI_ASSERT |
( |
|
EXPR, |
|
|
|
MSG |
|
) |
| Q_ASSERT_X(EXPR, __FILE__, MSG) |
Assert.
- Parameters
-
EXPR | assert expression |
MSG | message printed in case of assertion failure. |
◆ CUTEHMI_CRITICAL
#define CUTEHMI_CRITICAL |
( |
|
EXPR | ) |
qCCritical(loggingCategory()).nospace().noquote() << EXPR |
Print critical message.
- Parameters
-
EXPR | message (can be composed of stream expression). |
◆ CUTEHMI_DEBUG
#define CUTEHMI_DEBUG |
( |
|
EXPR | ) |
qCDebug(loggingCategory()).nospace().noquote() << EXPR |
Print debug message.
- Parameters
-
EXPR | message (can be composed of stream expression). |
◆ CUTEHMI_DIE
#define CUTEHMI_DIE |
( |
|
... | ) |
QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, loggingCategory().categoryName()).fatal(__VA_ARGS__) |
Print fatal message and abort or exit program.
- Parameters
-
... | fatal message and optional list of arguments interpreted by message format string. |
◆ CUTEHMI_INFO
#define CUTEHMI_INFO |
( |
|
EXPR | ) |
qCInfo(loggingCategory()).nospace().noquote() << EXPR |
Print informative message.
- Parameters
-
EXPR | message (can be composed of stream expression). |
◆ CUTEHMI_WARNING
#define CUTEHMI_WARNING |
( |
|
EXPR | ) |
qCWarning(loggingCategory()).nospace().noquote() << EXPR |
Print warning.
- Parameters
-
EXPR | message (can be composed of stream expression). |