diff options
-rw-r--r-- | examples/custom-appman/custom-appman.cpp | 2 | ||||
-rw-r--r-- | src/common-lib/logging.cpp | 14 | ||||
-rw-r--r-- | src/common-lib/logging.h | 1 | ||||
-rw-r--r-- | src/tools/appman/appman.cpp | 9 |
4 files changed, 18 insertions, 8 deletions
diff --git a/examples/custom-appman/custom-appman.cpp b/examples/custom-appman/custom-appman.cpp index ea23421b..38b96a25 100644 --- a/examples/custom-appman/custom-appman.cpp +++ b/examples/custom-appman/custom-appman.cpp @@ -65,7 +65,7 @@ Q_DECL_EXPORT int main(int argc, char *argv[]) QCoreApplication::setApplicationName(qSL("Custom ApplicationManager")); QCoreApplication::setApplicationVersion("0.1"); - Logging::initialize(); + Logging::initialize(argc, argv); Package::ensureCorrectLocale(); diff --git a/src/common-lib/logging.cpp b/src/common-lib/logging.cpp index acab9936..b74cb3b1 100644 --- a/src/common-lib/logging.cpp +++ b/src/common-lib/logging.cpp @@ -280,6 +280,20 @@ static void colorLogToStderr(QtMsgType msgType, const QMessageLogContext &contex void Logging::initialize() { + initialize(0, nullptr); +} + +void Logging::initialize(int argc, const char * const *argv) +{ + if (argc > 0 && argv) { + for (int i = 1; i < argc; ++i) { + if (strcmp("--no-dlt-logging", argv[i]) == 0) { + Logging::setDltEnabled(false); + break; + } + } + } + auto messageHandler = [](QtMsgType msgType, const QMessageLogContext &context, const QString &message) { #if defined(QT_GENIVIEXTRAS_LIB) if (s_dltEnabled) diff --git a/src/common-lib/logging.h b/src/common-lib/logging.h index a969261c..77aff74f 100644 --- a/src/common-lib/logging.h +++ b/src/common-lib/logging.h @@ -59,6 +59,7 @@ class Logging { public: static void initialize(); + static void initialize(int argc, const char * const *argv); static QStringList filterRules(); static void setFilterRules(const QStringList &rules); diff --git a/src/tools/appman/appman.cpp b/src/tools/appman/appman.cpp index 213d9dfd..6ad954ab 100644 --- a/src/tools/appman/appman.cpp +++ b/src/tools/appman/appman.cpp @@ -71,13 +71,8 @@ Q_DECL_EXPORT int main(int argc, char *argv[]) QCoreApplication::setOrganizationName(qSL("Pelagicore AG")); QCoreApplication::setOrganizationDomain(qSL("pelagicore.com")); QCoreApplication::setApplicationVersion(qSL(AM_VERSION)); - for (int i = 1; i < argc; ++i) { - if (strcmp("--no-dlt-logging", argv[i]) == 0) { - Logging::setDltEnabled(false); - break; - } - } - Logging::initialize(); + + Logging::initialize(argc, argv); StartupTimer::instance()->checkpoint("after basic initialization"); #if !defined(AM_DISABLE_INSTALLER) |