Browse Source

Add new VideoAllLog category which turns on all individual video logging categories

Fix QCWarning
QGC4.4
DonLakeFlyer 4 years ago committed by Don Gagne
parent
commit
aa98526cb0
  1. 34
      src/QGCLoggingCategory.cc
  2. 1
      src/QGCLoggingCategory.h
  3. 2
      src/VideoReceiver/GStreamer.cc

34
src/QGCLoggingCategory.cc

@ -15,6 +15,8 @@ @@ -15,6 +15,8 @@
#include <QSettings>
static const char* kVideoAllLogCategory = "VideoAllLog";
// Add Global logging categories (not class specific) here using QGC_LOGGING_CATEGORY
QGC_LOGGING_CATEGORY(FirmwareUpgradeLog, "FirmwareUpgradeLog")
QGC_LOGGING_CATEGORY(FirmwareUpgradeVerboseLog, "FirmwareUpgradeVerboseLog")
@ -26,6 +28,7 @@ QGC_LOGGING_CATEGORY(RTKGPSLog, "RTKGPSLog") @@ -26,6 +28,7 @@ QGC_LOGGING_CATEGORY(RTKGPSLog, "RTKGPSLog")
QGC_LOGGING_CATEGORY(GuidedActionsControllerLog, "GuidedActionsControllerLog")
QGC_LOGGING_CATEGORY(ADSBVehicleManagerLog, "ADSBVehicleManagerLog")
QGC_LOGGING_CATEGORY(LocalizationLog, "LocalizationLog")
QGC_LOGGING_CATEGORY(VideoAllLog, kVideoAllLogCategory)
QGCLoggingCategoryRegister* _instance = nullptr;
const char* QGCLoggingCategoryRegister::_filterRulesSettingsGroup = "LoggingFilters";
@ -64,18 +67,23 @@ bool QGCLoggingCategoryRegister::categoryLoggingOn(const QString& category) @@ -64,18 +67,23 @@ bool QGCLoggingCategoryRegister::categoryLoggingOn(const QString& category)
void QGCLoggingCategoryRegister::setFilterRulesFromSettings(const QString& commandLineLoggingOptions)
{
QString filterRules;
QString filterRuleFormat("%1.debug=true\n");
bool videoAllLogSet = false;
if (!commandLineLoggingOptions.isEmpty()) {
_commandLineLoggingOptions = commandLineLoggingOptions;
}
QString filterRules;
filterRules += "*Log.debug=false\n";
// Set up filters defined in settings
foreach (QString category, _registeredCategories) {
if (categoryLoggingOn(category)) {
filterRules += category;
filterRules += ".debug=true\n";
filterRules += filterRuleFormat.arg(category);
if (category == kVideoAllLogCategory) {
videoAllLogSet = true;
}
}
}
@ -86,17 +94,27 @@ void QGCLoggingCategoryRegister::setFilterRulesFromSettings(const QString& comma @@ -86,17 +94,27 @@ void QGCLoggingCategoryRegister::setFilterRulesFromSettings(const QString& comma
if (logList[0] == "full") {
filterRules += "*Log.debug=true\n";
for(int i=1; i<logList.count(); i++) {
filterRules += logList[i];
filterRules += ".debug=false\n";
filterRules += filterRuleFormat.arg(logList[i]);
}
} else {
foreach(const QString &rule, logList) {
filterRules += rule;
filterRules += ".debug=true\n";
for (auto& category: logList) {
filterRules += filterRuleFormat.arg(category);
if (category == kVideoAllLogCategory) {
videoAllLogSet = true;
}
}
}
}
if (videoAllLogSet) {
filterRules += filterRuleFormat.arg("VideoManagerLog");
filterRules += filterRuleFormat.arg("VideoReceiverLog");
filterRules += filterRuleFormat.arg("GStreamerLog");
}
// Logging from GStreamer library itself controlled by gstreamer debug levels is always turned on
filterRules += filterRuleFormat.arg("GStreamerAPILog");
qDebug() << "Filter rules" << filterRules;
QLoggingCategory::setFilterRules(filterRules);
}

1
src/QGCLoggingCategory.h

@ -23,6 +23,7 @@ Q_DECLARE_LOGGING_CATEGORY(RTKGPSLog) @@ -23,6 +23,7 @@ Q_DECLARE_LOGGING_CATEGORY(RTKGPSLog)
Q_DECLARE_LOGGING_CATEGORY(GuidedActionsControllerLog)
Q_DECLARE_LOGGING_CATEGORY(ADSBVehicleManagerLog)
Q_DECLARE_LOGGING_CATEGORY(LocalizationLog)
Q_DECLARE_LOGGING_CATEGORY(VideoAllLog) // turns on all individual QGC video logs
/// @def QGC_LOGGING_CATEGORY
/// This is a QGC specific replacement for Q_LOGGING_CATEGORY. It will register the category name into a

2
src/VideoReceiver/GStreamer.cc

@ -119,7 +119,7 @@ GStreamer::blacklist(VideoSettings::VideoDecoderOptions option) @@ -119,7 +119,7 @@ GStreamer::blacklist(VideoSettings::VideoDecoderOptions option)
auto changeRank = [registry](const char* featureName, uint16_t rank) {
GstPluginFeature* feature = gst_registry_lookup_feature(registry, featureName);
if (feature == nullptr) {
qCWarning(GStreamerLog) << "Failed to change ranking of feature:" << featureName;
qCDebug(GStreamerLog) << "Failed to change ranking of feature. Featuer does not exist:" << featureName;
return;
}

Loading…
Cancel
Save