diff options
author | Dominik Holland <dominik.holland@pelagicore.com> | 2015-06-08 19:59:29 +0200 |
---|---|---|
committer | Dominik Holland <dominik.holland@pelagicore.com> | 2015-06-08 19:59:29 +0200 |
commit | 1df246d40784d33ec6aef700c3b482cabc47b543 (patch) | |
tree | dcc0af983e8d9bba744febbeb0485facd5526977 /examples/geniviextras/qdlt/main.cpp | |
download | qtivi-1df246d40784d33ec6aef700c3b482cabc47b543.tar.gz |
First version of the QtGeniviExtras module
This version contains helper macros which makes it easy to map
QtLoggingCategories to DLT Categories and install a messagHandler
which logs all messages using libdlt
Diffstat (limited to 'examples/geniviextras/qdlt/main.cpp')
-rw-r--r-- | examples/geniviextras/qdlt/main.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/examples/geniviextras/qdlt/main.cpp b/examples/geniviextras/qdlt/main.cpp new file mode 100644 index 0000000..d26e08d --- /dev/null +++ b/examples/geniviextras/qdlt/main.cpp @@ -0,0 +1,25 @@ +#include <QCoreApplication> +#include <QTimer> +#include <QtGeniviExtras/QtDlt> + +#include "loggingcategories.h" + +int main(int argc, char *argv[]) +{ + qInstallMessageHandler(QDltRegistration::messageHandler); + + QCoreApplication a(argc, argv); + + QTimer timer; + timer.connect(&timer, &QTimer::timeout, [] { + static int counter = 0; + counter++; + qCCritical(FOO) << "FOO CATEGORY"; + qCWarning(BAR) << "BAR CATEGORY"; + qCritical() << "FALLBACK"; + }); + timer.setInterval(1000); + timer.start(); + + return a.exec(); +} |