Skip to content

Commit

Permalink
Added checkbox to allow debugging to settings>general>schedule in q…
Browse files Browse the repository at this point in the history
…t and the necessary code to common to make it work.

Fixes  bit-team#1616
  • Loading branch information
stcksmsh committed Apr 8, 2024
1 parent d33f35e commit d7f0ec0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
9 changes: 8 additions & 1 deletion common/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -958,6 +958,13 @@ def scheduleMode(self, profile_id = None):
def setScheduleMode(self, value, profile_id = None):
self.setProfileIntValue('schedule.mode', value, profile_id)

def debugSchedule(self, profile_id = None):
#?Enable debug output to system log for schedule mode.
return self.profileBoolValue('schedule.debug', False, profile_id)

def setDebugSchedule(self, value, profile_id = None):
self.setProfileBoolValue('schedule.debug', value, profile_id)

def scheduleTime(self, profile_id = None):
#?Position-coded number with the format "hhmm" to specify the hour
#?and minute the cronjob should start (eg. 2015 means a quarter
Expand Down Expand Up @@ -1756,7 +1763,7 @@ def cronCmd(self, profile_id):
cmd += '--profile-id %s ' % profile_id
if not self._LOCAL_CONFIG_PATH is self._DEFAULT_CONFIG_PATH:
cmd += '--config %s ' % self._LOCAL_CONFIG_PATH
if logger.DEBUG:
if logger.DEBUG or self.debugSchedule(profile_id):
cmd += '--debug '
cmd += 'backup-job'
if self.redirectStdoutInCron(profile_id):
Expand Down
9 changes: 9 additions & 0 deletions qt/settingsdialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,11 @@ def __init__(self, parent):

self.comboSchedule.currentIndexChanged.connect(self.scheduleChanged)

self.cbDebugSchedule = QCheckBox(self)
self.cbDebugSchedule.setText(_('Enable logging of debug messages'))
self.cbDebugSchedule.setToolTip(('Write debug-level messages into the system log. Warning: Use only to diagnose problems since it creates a lot of output.'))
glayout.addWidget(self.cbDebugSchedule, 8, 0)

#
layout.addStretch()
scrollArea.setWidget(layoutWidget)
Expand Down Expand Up @@ -1348,6 +1353,8 @@ def updateProfile(self):
self.config.scheduleRepeatedUnit())
self.updateSchedule(self.config.scheduleMode())

self.cbDebugSchedule.setChecked(self.config.debugSchedule())

# TAB: Include
self.listInclude.clear()

Expand Down Expand Up @@ -1584,6 +1591,8 @@ def saveProfile(self):
self.comboScheduleRepeatedUnit.itemData(
self.comboScheduleRepeatedUnit.currentIndex()))

self.config.setDebugSchedule(self.cbDebugSchedule.isChecked())

# auto-remove
self.config.setRemoveOldSnapshots(
self.cbRemoveOlder.isChecked(),
Expand Down

0 comments on commit d7f0ec0

Please sign in to comment.