QDltRegistration Class

The QDltRegistration class controls controls the mapping between QLoggingCategory and dlt context. More...

Header: #include <QDltRegistration>
qmake: QT += geniviextras
Inherits: QObject

Public Functions

QDltRegistration::LongMessageBehavior longMessageBehavior() const
void registerApplication(const char *dltAppID, const char *dltAppDescription)
void registerCategory(const QLoggingCategory *category, const char *dltCtxName, const char *dltCtxDescription)
void registerUnregisteredContexts()
void setDefaultContext(const char *categoryName)
void setLongMessageBehavior(QDltRegistration::LongMessageBehavior config)
void setRegisterContextOnFirstUseEnabled(bool enabled)
void unregisterApplication()

Signals

void logLevelChanged(const QLoggingCategory *category)

Static Public Members

void messageHandler(QtMsgType msgType, const QMessageLogContext &msgCtx, const QString &msg)

Detailed Description

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.

Member Function Documentation

[signal] 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 category.

Note: This signal requires a dlt-daemon version equal to 2.12 or higher.

[static] void QDltRegistration::messageHandler(QtMsgType msgType, const QMessageLogContext &msgCtx, const QString &msg)

The Qt message handler which forwards all the logging messages to the dlt-daemon.

The function will map msgTypes to the appropriate dlt log level and forward the msg to the dlt context matching the category in msgCtx.

If the category in 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:

qInstallMessageHandler(QDltRegistration::messageHandler);

void QDltRegistration::registerApplication(const char *dltAppID, const char *dltAppDescription)

Registers this application with the dlt-daemon using dltAppID and dltAppDescription.

Per process only one application can be registered. Calling this function after an application is already registered, will register the application under the new dltAppID and dltAppDescription and also populating the already registered dlt contexts under this application. Calling the method with an empty dltAppID will update just the description if the app was already registered before.

See also QDLT_REGISTER_APPLICATION.

void QDltRegistration::registerCategory(const QLoggingCategory *category, const char *dltCtxName, const char *dltCtxDescription)

Registers category with the dlt-daemon using dltCtxName and dltCtxDescription.

This function shouldn't be used directly, instead use the convenience macro.

See also QDLT_LOGGING_CATEGORY and QDLT_REGISTER_LOGGING_CATEGORY.

void QDltRegistration::registerUnregisteredContexts()

Registers all contexts with the dlt-daemon which are not yet registered.

This function can be used in combination with setRegisterContextOnFirstUseEnabled to delay the registration with the dlt-daemon until it is really needed and once it is safe to register all context which haven't been registered yet, e.g. by using the associated logging category.

See also setRegisterContextOnFirstUseEnabled.

void QDltRegistration::setDefaultContext(const char *categoryName)

Sets categoryName as the fallback logging category.

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.

See also QDLT_FALLBACK_CATEGORY.

void QDltRegistration::setRegisterContextOnFirstUseEnabled(bool enabled)

When set to enabled the registration with the dlt-daemon is done on the first use of the category.

Otherwise the registration is done directly when QDLT_LOGGING_CATEGORY or QDLT_REGISTER_LOGGING_CATEGORY is called.

This function shouldn't be used directly, instead use the convenience macro.

See also QDLT_REGISTER_CONTEXT_ON_FIRST_USE.

void QDltRegistration::unregisterApplication()

Unregisters the application with the dlt-daemon. The registered application as well as all registered dlt context will be deleted.

© 2020 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.