fix(settings): It's not possible to switch the log level (#13309)
* chore: bump status-go Closes #13139 * fix(settings): It's not possible to switch the log level Previously it was not possible to change the state of the Debug toggle. This is because the code forced the setting the default value, ignoring the database setup, hence always setting the DEBUG as LogLevel. Closes #13139
This commit is contained in:
parent
0dd07a825a
commit
ae16bd8b67
|
@ -63,6 +63,9 @@ method toggleAutoMessage*(self: AccessInterface) {.base.} =
|
||||||
method isDebugEnabled*(self: AccessInterface): bool {.base.} =
|
method isDebugEnabled*(self: AccessInterface): bool {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
|
method isRuntimeLogLevelSet*(self: AccessInterface): bool {.base.} =
|
||||||
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method toggleDebug*(self: AccessInterface) {.base.} =
|
method toggleDebug*(self: AccessInterface) {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
|
|
|
@ -105,6 +105,9 @@ method toggleDebug*(self: Module) =
|
||||||
method onDebugToggled*(self: Module) =
|
method onDebugToggled*(self: Module) =
|
||||||
self.view.isDebugEnabledChanged()
|
self.view.isDebugEnabledChanged()
|
||||||
|
|
||||||
|
method isRuntimeLogLevelSet*(self: Module): bool =
|
||||||
|
return constants.runtimeLogLevelSet()
|
||||||
|
|
||||||
method toggleWalletSection*(self: Module) =
|
method toggleWalletSection*(self: Module) =
|
||||||
self.controller.toggleWalletSection()
|
self.controller.toggleWalletSection()
|
||||||
|
|
||||||
|
|
|
@ -88,6 +88,11 @@ QtObject:
|
||||||
proc toggleDebug*(self: View) {.slot.} =
|
proc toggleDebug*(self: View) {.slot.} =
|
||||||
self.delegate.toggleDebug()
|
self.delegate.toggleDebug()
|
||||||
|
|
||||||
|
proc getIsRuntimeLogLevelSet*(self: View): bool {.slot.} =
|
||||||
|
return self.delegate.isRuntimeLogLevelSet()
|
||||||
|
QtProperty[bool] isRuntimeLogLevelSet:
|
||||||
|
read = getIsRuntimeLogLevelSet
|
||||||
|
|
||||||
proc toggleWalletSection*(self: View) {.slot.} =
|
proc toggleWalletSection*(self: View) {.slot.} =
|
||||||
self.delegate.toggleWalletSection()
|
self.delegate.toggleWalletSection()
|
||||||
|
|
||||||
|
|
|
@ -405,7 +405,8 @@ QtObject:
|
||||||
"TorrentDir": DEFAULT_TORRENT_CONFIG_TORRENTDIR
|
"TorrentDir": DEFAULT_TORRENT_CONFIG_TORRENTDIR
|
||||||
}
|
}
|
||||||
|
|
||||||
result["LogLevel"] = newJString(toStatusGoSupportedLogLevel(main_constants.LOG_LEVEL))
|
if main_constants.runtimeLogLevelSet():
|
||||||
|
result["RuntimeLogLevel"] = newJString(toStatusGoSupportedLogLevel(main_constants.LOG_LEVEL))
|
||||||
|
|
||||||
if STATUS_PORT != 0:
|
if STATUS_PORT != 0:
|
||||||
result["ListenAddr"] = newJString("0.0.0.0:" & $main_constants.STATUS_PORT)
|
result["ListenAddr"] = newJString("0.0.0.0:" & $main_constants.STATUS_PORT)
|
||||||
|
|
|
@ -5,6 +5,7 @@ import ../settings/service as settings_service
|
||||||
import ../../../app/core/eventemitter
|
import ../../../app/core/eventemitter
|
||||||
import ../../../app/core/fleets/fleet_configuration
|
import ../../../app/core/fleets/fleet_configuration
|
||||||
import ../../../backend/node_config as status_node_config
|
import ../../../backend/node_config as status_node_config
|
||||||
|
import ../../../constants as main_constants
|
||||||
|
|
||||||
export node_config
|
export node_config
|
||||||
|
|
||||||
|
@ -14,7 +15,9 @@ logScope:
|
||||||
const WAKU_VERSION_1* = 1
|
const WAKU_VERSION_1* = 1
|
||||||
const WAKU_VERSION_2* = 2
|
const WAKU_VERSION_2* = 2
|
||||||
|
|
||||||
const SIGNAL_NODE_LOG_LEVEL_UPDATE* = "nodeLogLevelUpdated"
|
const
|
||||||
|
SIGNAL_NODE_LOG_LEVEL_UPDATE* = "nodeLogLevelUpdated"
|
||||||
|
DEBUG_LOG_LEVELS = @["DEBUG", "TRACE"]
|
||||||
|
|
||||||
type
|
type
|
||||||
NodeLogLevelUpdatedArgs* = ref object of Args
|
NodeLogLevelUpdatedArgs* = ref object of Args
|
||||||
|
@ -194,7 +197,10 @@ proc getLogLevel(self: Service): string =
|
||||||
return self.configuration.LogLevel
|
return self.configuration.LogLevel
|
||||||
|
|
||||||
proc isDebugEnabled*(self: Service): bool =
|
proc isDebugEnabled*(self: Service): bool =
|
||||||
return self.getLogLevel() == $LogLevel.DEBUG
|
var logLevel = self.getLogLevel()
|
||||||
|
if main_constants.runtimeLogLevelSet():
|
||||||
|
logLevel = main_constants.LOG_LEVEL
|
||||||
|
return logLevel in DEBUG_LOG_LEVELS
|
||||||
|
|
||||||
proc setLogLevel*(self: Service, logLevel: LogLevel): bool =
|
proc setLogLevel*(self: Service, logLevel: LogLevel): bool =
|
||||||
var newConfiguration = self.configuration
|
var newConfiguration = self.configuration
|
||||||
|
|
|
@ -16,6 +16,7 @@ QtObject {
|
||||||
property bool isDebugEnabled: advancedModule? advancedModule.isDebugEnabled : false
|
property bool isDebugEnabled: advancedModule? advancedModule.isDebugEnabled : false
|
||||||
readonly property bool isWakuV2ShardedCommunitiesEnabled: localAppSettings.wakuV2ShardedCommunitiesEnabled ?? false
|
readonly property bool isWakuV2ShardedCommunitiesEnabled: localAppSettings.wakuV2ShardedCommunitiesEnabled ?? false
|
||||||
property int logMaxBackups: advancedModule ? advancedModule.logMaxBackups : 1
|
property int logMaxBackups: advancedModule ? advancedModule.logMaxBackups : 1
|
||||||
|
property bool isRuntimeLogLevelSet: advancedModule ? advancedModule.isRuntimeLogLevelSet: false
|
||||||
|
|
||||||
property var customNetworksModel: advancedModule? advancedModule.customNetworksModel : []
|
property var customNetworksModel: advancedModule? advancedModule.customNetworksModel : []
|
||||||
|
|
||||||
|
|
|
@ -354,10 +354,26 @@ SettingsContentBase {
|
||||||
anchors.rightMargin: 0
|
anchors.rightMargin: 0
|
||||||
text: qsTr("Debug")
|
text: qsTr("Debug")
|
||||||
isSwitch: true
|
isSwitch: true
|
||||||
|
isEnabled: !root.advancedStore.isRuntimeLogLevelSet
|
||||||
switchChecked: root.advancedStore.isDebugEnabled
|
switchChecked: root.advancedStore.isDebugEnabled
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
Global.openPopup(enableDebugComponent)
|
Global.openPopup(enableDebugComponent)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: overlayMouseArea
|
||||||
|
anchors.fill: parent
|
||||||
|
enabled: true
|
||||||
|
hoverEnabled: true
|
||||||
|
propagateComposedEvents: true
|
||||||
|
}
|
||||||
|
|
||||||
|
StatusToolTip {
|
||||||
|
text: qsTr("The value is overridden with runtime options")
|
||||||
|
visible: overlayMouseArea.containsMouse && root.advancedStore.isRuntimeLogLevelSet
|
||||||
|
delay: 1000
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: replace with StatusQ component
|
// TODO: replace with StatusQ component
|
||||||
|
|
|
@ -54,7 +54,7 @@ Rectangle {
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
text: root.text
|
text: root.text
|
||||||
font.pixelSize: 15
|
font.pixelSize: 15
|
||||||
color: !root.isEnabled ? Style.current.secondaryText : Style.current.textColor
|
color: Style.current.textColor
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 9c131edfaa47ab38fe25048a7116dc4c54336336
|
Subproject commit 4584de34b096f93e6f1be760cd1105f956c91962
|
Loading…
Reference in New Issue