QTraceGuard Class

The QTraceGuard class facilitates notifications to QTracer objects. More...

Header: #include <QTraceGuard>
qmake: QT += core
Since: Qt 5.2

Detailed Description

The QTraceGuard class facilitates notifications to QTracer objects.

QTraceGuard objects are typically implicitly created on the stack when using the qCTrace or qCTraceGuard macros and are associated to a QLoggingCategory.

The constructor of a QTraceGuard objects checks whether its associated category is enabled, and if so, informs all QTracer objects registered with the category that a tracing activity starts.

The destructor of a QTraceGuard objects checks whether its associated category is enabled, and if so, informs all QTracer objects registered with the category that a tracing activity ended.

A QTraceGuard object created by qCTrace will be destroyed at the end of the full expression, a guard created by qCTraceGuard at the end of the block containing the macro.

During the lifetime of a QTraceGuard object, its operator<<() can be used to pass additional data to the active tracers. The fast path handles only int and const char * data, but it is possible to use arbitrary values wrapped in QVariants.

See also QTracer.