Skip to content

Commit

Permalink
Merge pull request #60051 from qgis/backport-60049-to-release-3_40
Browse files Browse the repository at this point in the history
[Backport release-3_40] [MetaSearch] Allow the user to enable or disable the logging of the debug messages
  • Loading branch information
rouault authored Jan 7, 2025
2 parents 50211e5 + ccede01 commit 025f43a
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
9 changes: 9 additions & 0 deletions python/plugins/MetaSearch/dialogs/maindialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ def __init__(self, iface):
self.disable_ssl_verification = self.settings.value(
"/MetaSearch/disableSSL", False, bool
)
self.log_debugging_messages = self.settings.value(
"/MetaSearch/logDebugging", False, bool
)

# Services tab
self.cmbConnectionsServices.activated.connect(self.save_connection)
Expand Down Expand Up @@ -181,6 +184,10 @@ def _on_ssl_state_change(state):
self.settings.setValue("/MetaSearch/disableSSL", bool(state))
self.disable_ssl_verification = bool(state)

def _on_debugging_state_change(state):
self.settings.setValue("/MetaSearch/logDebugging", bool(state))
self.log_debugging_messages = bool(state)

self.tabWidget.setCurrentIndex(0)
self.populate_connection_list()
self.btnRawAPIResponse.setEnabled(False)
Expand All @@ -192,6 +199,8 @@ def _on_ssl_state_change(state):
self.spnTimeout.valueChanged.connect(_on_timeout_change)
self.disableSSLVerification.setChecked(self.disable_ssl_verification)
self.disableSSLVerification.stateChanged.connect(_on_ssl_state_change)
self.logDebuggingMessages.setChecked(self.log_debugging_messages)
self.logDebuggingMessages.stateChanged.connect(_on_debugging_state_change)

key = "/MetaSearch/%s" % self.cmbConnectionsSearch.currentText()
self.catalog_url = self.settings.value("%s/url" % key)
Expand Down
30 changes: 30 additions & 0 deletions python/plugins/MetaSearch/ui/maindialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,36 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_5">
<property name="title">
<string>Debugging</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_12">
<property name="text">
<string>Log debugging messages</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="logDebuggingMessages">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_13">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
Expand Down
4 changes: 3 additions & 1 deletion python/plugins/MetaSearch/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,4 +174,6 @@ def clean_ows_url(url):
def log_message(message, level=Qgis.MessageLevel.Info):
"""helper function to emit logging messages"""

LOGGER.logMessage(message, "MetaSearch", level)
logging = QgsSettings().value("/MetaSearch/logDebugging", False, bool)
if logging:
LOGGER.logMessage(message, "MetaSearch", level)

0 comments on commit 025f43a

Please sign in to comment.