aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Holland <dominik.holland@pelagicore.com>2019-08-22 13:35:36 +0200
committerDominik Holland <dominik.holland@pelagicore.com>2019-08-30 21:15:44 +0200
commitb3bb651ddec3c04e4464e7e8baff0c5d191c8ded (patch)
tree55c8bb63f7d136109b6590042e84edc4208da5c8
parent839d63d234fa89e1cc50669ea4976b63df465e2b (diff)
geniviextras: Implement the missing severity2dltLevel function
The function was defined already before, but it didn't have an implementation. Change-Id: If234d83cbcd15bee6e24459c9bd27ff9d6ae05a2 Reviewed-by: Robert Griebl <robert.griebl@pelagicore.com>
-rw-r--r--src/geniviextras/qdltregistration.cpp30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/geniviextras/qdltregistration.cpp b/src/geniviextras/qdltregistration.cpp
index a82e173..67e7c15 100644
--- a/src/geniviextras/qdltregistration.cpp
+++ b/src/geniviextras/qdltregistration.cpp
@@ -205,6 +205,20 @@ DltLogLevelType QDltRegistrationPrivate::category2dltLevel(const QLoggingCategor
return logLevel;
}
+DltLogLevelType QDltRegistrationPrivate::severity2dltLevel(QtMsgType type)
+{
+ switch (type) {
+ case QtDebugMsg: return DLT_LOG_DEBUG;
+#if QT_VERSION >= 0x050500
+ case QtInfoMsg: return DLT_LOG_INFO;
+#endif
+ case QtWarningMsg: return DLT_LOG_WARN;
+ case QtCriticalMsg: return DLT_LOG_ERROR;
+ case QtFatalMsg: return DLT_LOG_FATAL;
+ }
+ return DLT_LOG_OFF;
+}
+
/*!
\class QDltRegistration
\inmodule QtGeniviExtras
@@ -359,25 +373,15 @@ void QDltRegistration::unregisterApplication()
qInstallMessageHandler(QDltRegistration::messageHandler);
\endcode
*/
-void QDltRegistration::messageHandler(QtMsgType msgTypes, const QMessageLogContext &msgCtx, const QString &msg)
+void QDltRegistration::messageHandler(QtMsgType msgType, const QMessageLogContext &msgCtx, const QString &msg)
{
DltContext *dltCtx = globalDltRegistration()->d_ptr->context(msgCtx.category);
if (!dltCtx)
return;
- DltLogLevelType logLevel = DLT_LOG_OFF;
-
- switch (msgTypes) {
- case QtDebugMsg: logLevel = DLT_LOG_DEBUG; break;
-#if QT_VERSION >= 0x050500
- case QtInfoMsg: logLevel = DLT_LOG_INFO; break;
-#endif
- case QtWarningMsg: logLevel = DLT_LOG_WARN; break;
- case QtCriticalMsg: logLevel = DLT_LOG_ERROR; break;
- case QtFatalMsg: logLevel = DLT_LOG_FATAL; break;
- }
+ DltLogLevelType logLevel = globalDltRegistration()->d_ptr->severity2dltLevel(msgType);
- DLT_LOG(*dltCtx, logLevel, DLT_STRING(qPrintable(qFormatLogMessage(msgTypes, msgCtx, msg))));
+ DLT_LOG(*dltCtx, logLevel, DLT_STRING(qPrintable(qFormatLogMessage(msgType, msgCtx, msg))));
}
/*!