diff options
author | Dominik Holland <dominik.holland@pelagicore.com> | 2016-11-23 17:30:46 +0100 |
---|---|---|
committer | Dominik Holland <dominik.holland@pelagicore.com> | 2016-11-23 17:30:46 +0100 |
commit | 465f64cdd9a6f97893e77c9b46bfd1a2f830084d (patch) | |
tree | ea34f8670c517fcd4f3a2740a8f68e14d931c330 /src/geniviextras/qdltregistration.cpp | |
parent | 040b5aed0b395356fbd779bfd58e535a24c95fe6 (diff) | |
parent | 6cd72e69344538a3c91842128b8b062aef9775d8 (diff) |
Merge branch '5.7' into dev
Change-Id: I3feb8544b54c7e84970ae304ea5e8c44bcd30a46
Diffstat (limited to 'src/geniviextras/qdltregistration.cpp')
-rw-r--r-- | src/geniviextras/qdltregistration.cpp | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/src/geniviextras/qdltregistration.cpp b/src/geniviextras/qdltregistration.cpp index de922da..6f61eac 100644 --- a/src/geniviextras/qdltregistration.cpp +++ b/src/geniviextras/qdltregistration.cpp @@ -181,6 +181,18 @@ DltLogLevelType QDltRegistrationPrivate::category2dltLevel(const QLoggingCategor return logLevel; } +/*! + \class QDltRegistration + \inmodule QtGeniviExtras + \brief The QDltRegistration class controls controls the mapping between QLoggingCategory and dlt context. + + The class talks to the dlt-daemon and provides a Qt messageHandler which forwards logging messages logged + by the Qt Logging Framework to the dlt-daemon. + + Using dlt-daemon version 2.12 or higher it also reacts to DLT control messages and adapts the enabled msg + types of a QLoggingCategory whenever the log level of a dlt context changes. +*/ + QDltRegistration::QDltRegistration() : d_ptr(new QDltRegistrationPrivate(this)) { @@ -191,6 +203,12 @@ QDltRegistration::~QDltRegistration() unregisterApplication(); } +/*! + Registers this application with the dlt-daemon using \a dltAppID and \a dltAppDescription. + + This function shouldn't be used directly, instead use the convenience macro. + \sa QDLT_REGISTER_APPLICATION +*/ void QDltRegistration::registerApplication(const char *dltAppID, const char *dltAppDescription) { Q_D(QDltRegistration); @@ -198,6 +216,12 @@ void QDltRegistration::registerApplication(const char *dltAppID, const char *dlt DLT_REGISTER_APP(dltAppID, dltAppDescription); } +/*! + Registers \a category with the dlt-daemon using \a dltCtxName and \a dltCtxDescription. + + This function shouldn't be used directly, instead use the convenience macro. + \sa QDLT_LOGGING_CATEGORY QDLT_REGISTER_LOGGING_CATEGORY +*/ void QDltRegistration::registerCategory(const QLoggingCategory *category, const char *dltCtxName, const char *dltCtxDescription) { Q_D(QDltRegistration); @@ -208,6 +232,15 @@ void QDltRegistration::registerCategory(const QLoggingCategory *category, const d->registerCategory(category, new DltContext, dltCtxName, dltCtxDescription); } +/*! + Sets \a categoryName as the fallback logging category. + + \a categoryName needs to be the name of a valid QLoggingCategory which has been registered within the dlt-daemon. + Either by using QDLT_LOGGING_CATEGORY or QDLT_REGISTER_LOGGING_CATEGORY. + + This function shouldn't be used directly, instead use the convenience macro. + \sa QDLT_FALLBACK_CATEGORY +*/ void QDltRegistration::setDefaultContext(const char *categoryName) { Q_D(QDltRegistration); @@ -220,6 +253,10 @@ void QDltRegistration::setRegisterContextOnFirstUseEnabled(bool enabled) d->m_registerOnFirstUse = enabled; } +/*! + Unregisters the application with the dlt-daemon. + The registered application as well as all registered dlt context will be deleted. +*/ void QDltRegistration::registerUnregisteredContexts() { Q_D(QDltRegistration); @@ -238,6 +275,20 @@ void QDltRegistration::unregisterApplication() DLT_UNREGISTER_APP(); } +/*! + The Qt message handler which forwards all the logging messages to the dlt-daemon. + + The function will map \a msgTypes to the appropriate dlt log level and forward the \a msg to + the dlt context matching the category in \a msgCtx. + + If the category in \a msgCtx hasn't been registered with a dlt context, the fallback logging category + will be used instead (if one is registered). + + This messageHandler needs to be installed using: + \badcode + qInstallMessageHandler(QDltRegistration::messageHandler); + \endcode +*/ void QDltRegistration::messageHandler(QtMsgType msgTypes, const QMessageLogContext &msgCtx, const QString &msg) { DltContext *dltCtx = globalDltRegistration()->d_ptr->context(msgCtx.category); @@ -258,3 +309,13 @@ void QDltRegistration::messageHandler(QtMsgType msgTypes, const QMessageLogConte DLT_LOG(*dltCtx, logLevel, DLT_STRING(qPrintable(qFormatLogMessage(msgTypes, msgCtx, msg)))); } + +/*! + \fn void QDltRegistration::logLevelChanged(const QLoggingCategory *category) + + This signal is emitted whenever the dlt-daemon changes the log level of a dlt context and + the dlt context is registered with a QLoggingCategory. The updated QLoggingCategory is passed + as \a category. + + \note This signal requires a dlt-daemon version equal to 2.12 or higher. +*/ |