Commit 7422552a authored by Don Gagne's avatar Don Gagne

Add new --logging command line option support

Remove old —full-logging
parent cfa7c988
......@@ -180,14 +180,15 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting)
// Parse command line options
bool fClearSettingsOptions = false; // Clear stored settings
bool fullLogging = false; // Turn on all logging
bool logging = false; // Turn on logging
QString loggingOptions;
CmdLineOpt_t rgCmdLineOptions[] = {
{ "--clear-settings", &fClearSettingsOptions, QString() },
{ "--full-logging", &fullLogging, QString() },
{ "--fake-mobile", &_fakeMobile, QString() },
{ "--clear-settings", &fClearSettingsOptions, NULL },
{ "--logging", &logging, &loggingOptions },
{ "--fake-mobile", &_fakeMobile, NULL },
#ifdef QT_DEBUG
{ "--test-high-dpi", &_testHighDPI, QString() },
{ "--test-high-dpi", &_testHighDPI, NULL },
#endif
// Add additional command line option flags here
};
......@@ -197,8 +198,24 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting)
#ifdef __mobile__
QLoggingCategory::setFilterRules(QStringLiteral("*Log.debug=false"));
#else
if (fullLogging) {
QLoggingCategory::setFilterRules(QStringLiteral("*Log=true"));
if (logging) {
QString filterRules;
QStringList logList = loggingOptions.split(",");
if (logList[0] == "full") {
filterRules += "*Log.debug=true\n";
for(int i=1; i<logList.count(); i++) {
filterRules += logList[i];
filterRules += ".debug=false\n";
}
} else {
foreach(QString rule, logList) {
filterRules += rule;
filterRules += ".debug=true\n";
}
}
qDebug() << "Filter rules" << filterRules;
QLoggingCategory::setFilterRules(filterRules);
} else {
if (_runningUnitTests) {
// We need to turn off these warnings until the firmware meta data is cleaned up
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment