From 11c9475e62ac920f38c4cadd09485b1719aa7818 Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Wed, 28 Feb 2024 16:25:45 +0100 Subject: [PATCH] add message-handler --- main.cpp | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/main.cpp b/main.cpp index ef52534..4daa5b9 100644 --- a/main.cpp +++ b/main.cpp @@ -1,9 +1,41 @@ #include +#include +#include + +#include "message_handler.h" + +#if defined (__unix__) || defined (__linux__) +#include +#include +#endif + +#ifdef PTU5 +#define SERIAL_PORT "ttymxc2" +#else +#define SERIAL_PORT "ttyUSB0" +#endif int main(int argc, char **argv) { Q_UNUSED(argc); Q_UNUSED(argv); - return 0; + QByteArray const value = qgetenv("LC_ALL"); + if (value != "C") { + qputenv("LC_ALL", "C"); + } + // qputenv("XDG_RUNTIME_DIR", "/var/run/user/0"); + + openlog("ATB-DL-JSON", LOG_PERROR | LOG_PID | LOG_CONS, LOG_USER); + + QCoreApplication a(argc, argv); + QCoreApplication::setApplicationName("ATBDownloadDCJsonFiles"); + QCoreApplication::setApplicationVersion(APP_VERSION); + + if (!messageHandlerInstalled()) { // change internal qt-QDebug-handling + atbInstallMessageHandler(atbDebugOutput); + setDebugLevel(LOG_NOTICE); + } + + return a.exec(); }