<QtDlt> - Qt DLT Declarations

The <QtDlt> header file includes macros to register with a dlt-daemon and map QLoggingCategories to dlt contexts. More...

Header: #include <QtDlt>

Macros

QDLT_FALLBACK_CATEGORY(CATEGORY)
QDLT_LOGGING_CATEGORY(CATEGORY, CATEGORYNAME, DLT_CTX_NAME, DLT_CTX_DESCRIPTION)
QDLT_REGISTER_APPLICATION(NAME, DESCRIPTION)
QDLT_REGISTER_CONTEXT_ON_FIRST_USE(ENABLED)
QDLT_REGISTER_LOGGING_CATEGORY(CATEGORY, CATEGORYNAME, DLT_CTX_NAME, DLT_CTX_DESCRIPTION)

Detailed Description

GENIVI DLT

GENIVI DLT is a logging system for automotive. It consists of two applications; a logging daemon (dlt-daemon) to collect logs of various applications and the linux system, and a viewer application (dlt-viewer) that runs on the host and can connect to targets running a dlt-daemon.

The dlt-daemon can be configured to log to a file, or forward logs to another dlt-daemon in the multiple ECU case. For further information about the dlt-daemon, see the dlt-daemon documentation.

DLT Applications, Contexts, and Log Level

Every application that wants to log to the dlt-daemon needs to register itself. Applications are identified by a four characters long identifier and a longer description for the dlt-viewer.

Every registered application can register multiple dlt contexts, which consist of a 3 characters long identifier and a comprehensive description.

Every dlt context has a current log level, which defines which logs are forwarded to the dlt-daemon or are discarded already in the application.

Controlling the dlt-daemon

The dlt-daemon is controlled by the dlt-viewer running on a host machine. The dlt-viewer can see all the applications that are registered to the dlt-daemon, along with their contexts and current log levels. All logs are forwarded from the dlt-daemon to the connected dlt-viewer, and can be filtered and exported.

In addition, the dlt-viewer can send so called "control messages" to the dlt-daemon to change the log level of a dlt context. Beginning with dlt-daemon version 2.12, these "control messages" are also forwarded to the logging application and is parsed by Qt to also set the matching log level of the registered QLoggingCategory.

Qt Message Type Mapping

As the DLT system isn't a one to one match to the Qt Categorized Logging system, a mapping of the log levels is needed. With DLT, it's not possible to only enable a specific message type of a QLoggingCategory as DLT only defines the maximum log level. Because of this limitation all lower message types are automatically enabled once a dlt contexts log level is changed.

The following mapping is used for logging to DLT:

Qt Message TypeDLT log level
QtDebugMsgDLT_LOG_DEBUG
QtInfoMsgDLT_LOG_INFO
QtWarningMsgDLT_LOG_WARN
QtCriticalMsgDLT_LOG_ERROR
QtFatalMsgDLT_LOG_FATAL
No message type enabledDLT_LOG_OFF

Changing the log level using dlt-viewer enables the following message types:

DLT log levelQt Message Types
DLT_LOG_VERBOSEQtDebugMsg QtInfoMsg QtWarningMsg QtCriticalMsg QtFatalMsg
DLT_LOG_INFOQtDebugMsg QtInfoMsg QtWarningMsg QtCriticalMsg QtFatalMsg
DLT_LOG_DEBUGQtInfoMsg QtWarningMsg QtCriticalMsg QtFatalMsg
DLT_LOG_WARNQtWarningMsg QtCriticalMsg QtFatalMsg
DLT_LOG_ERRORQtCriticalMsg QtFatalMsg
DLT_LOG_FATALQtFatalMsg
DLT_LOG_OFFNo message type enabled

Macro Documentation

QDLT_FALLBACK_CATEGORY(CATEGORY)

Registers an existing QLoggingCategory CATEGORY as the dlt fallback category. CATEGORY must be already mapped to a dlt context by using QDLT_LOGGING_CATEGORY or QDLT_REGISTER_LOGGING_CATEGORY. The fallback category is used for all log messages, which are not mapped to dlt contexts or don't use a QLoggingCategory.

QDLT_LOGGING_CATEGORY(CATEGORY, CATEGORYNAME, DLT_CTX_NAME, DLT_CTX_DESCRIPTION)

Defines a new QLoggingCategory CATEGORY and makes it configurable under the CATEGORYNAME identifier. The dlt context will be registered as DLT_CTX_NAME and using DLT_CTX_DESCRIPTION as a description.

Note: DLT_CTX_NAME is limited to (a size of) 3 characters.

QDLT_REGISTER_APPLICATION(NAME, DESCRIPTION)

Registers an application with the dlt-daemon as NAME and DESCRIPTION. All registered DLT Logging Categories will be part of this application in the dlt-daemon. Only one application can be registered per process.

Note: NAME is limited to (a size of) 4 characters.

QDLT_REGISTER_CONTEXT_ON_FIRST_USE(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.

QDLT_REGISTER_LOGGING_CATEGORY(CATEGORY, CATEGORYNAME, DLT_CTX_NAME, DLT_CTX_DESCRIPTION)

Registers an existing QLoggingCategory CATEGORY configurable under the CATEGORYNAME identifier. The new category is mapped to the dlt context, DLT_CTX_NAME, with the DLT_CTX_DESCRIPTION.

Note: DLT_CTX_NAME is limited to (a size of) 3 characters.

© 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.