diff --git a/src/app_service/service/node_configuration/service.nim b/src/app_service/service/node_configuration/service.nim index bda53d0a58..6ddd90aa0e 100644 --- a/src/app_service/service/node_configuration/service.nim +++ b/src/app_service/service/node_configuration/service.nim @@ -72,6 +72,8 @@ proc init*(self: Service) = return proc saveConfiguration(self: Service, configuration: NodeConfigDto): bool = + # FIXME: this method should be removed and the configuration should be updated in the status-go + # (see SetLogLevel, #14643) if(not self.settingsService.saveNodeConfiguration(configuration.toJsonNode())): error "error saving node configuration " return false @@ -205,14 +207,16 @@ proc isDebugEnabled*(self: Service): bool = return logLevel in DEBUG_LOG_LEVELS proc setLogLevel*(self: Service, logLevel: LogLevel): bool = - var newConfiguration = self.configuration - newConfiguration.LogLevel = $logLevel - if self.saveConfiguration(newConfiguration): - self.events.emit(SIGNAL_NODE_LOG_LEVEL_UPDATE, NodeLogLevelUpdatedArgs(logLevel: logLevel)) - return true - else: + let response = status_node_config.setLogLevel(logLevel) + + if not response.error.isNil: + error "failed to set log level: ", errDescription = response.error.message return false + self.configuration.LogLevel = $logLevel + self.events.emit(SIGNAL_NODE_LOG_LEVEL_UPDATE, NodeLogLevelUpdatedArgs(logLevel: logLevel)) + return true + proc getNimbusProxyConfig(self: Service): bool = return self.configuration.NimbusProxyConfig.Enabled diff --git a/src/backend/node_config.nim b/src/backend/node_config.nim index 02d5727965..6a5b25026f 100644 --- a/src/backend/node_config.nim +++ b/src/backend/node_config.nim @@ -40,4 +40,14 @@ proc disableCommunityHistoryArchiveSupport*(): RpcResponse[JsonNode] = result = core.callPrivateRPC("disableCommunityHistoryArchiveProtocol".prefix) except RpcException as e: error "error doing rpc request", methodName = "disableCommunityHistoryArchiveProtocol", exception=e.msg - raise newException(RpcException, e.msg) \ No newline at end of file + raise newException(RpcException, e.msg) + +proc setLogLevel*(logLevel: LogLevel): RpcResponse[JsonNode] = + try: + let payload = %*[{ + "logLevel": $logLevel + }] + result = core.callPrivateRPC("setLogLevel".prefix, payload) + except RpcException as e: + error "error doing rpc request", methodName = "setLogLevel", exception=e.msg + raise newException(RpcException, e.msg)