Log errors rather than printing them

This way we can debug them if a user sends us the logs.
This commit is contained in:
Ghostkeeper 2019-09-12 15:45:10 +02:00
parent 2d2bf9e279
commit 3a3aeb92a9
No known key found for this signature in database
GPG key ID: 86BEF881AE2CF276
2 changed files with 5 additions and 2 deletions

View file

@ -1,5 +1,6 @@
# Copyright (c) 2019 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
from typing import Optional, Dict, List, Callable, Any
from PyQt5.QtGui import QDesktopServices
@ -8,6 +9,7 @@ from PyQt5.QtNetwork import QNetworkReply
from UM.FileHandler.FileHandler import FileHandler
from UM.i18n import i18nCatalog
from UM.Logger import Logger
from UM.Scene.SceneNode import SceneNode
from cura.PrinterOutput.NetworkedPrinterOutputDevice import AuthState
from cura.PrinterOutput.PrinterOutputDevice import ConnectionType
@ -167,5 +169,5 @@ class LocalClusterOutputDevice(UltimakerNetworkedPrinterOutputDevice):
## Get the API client instance.
def _getApiClient(self) -> ClusterApiClient:
if not self._cluster_api:
self._cluster_api = ClusterApiClient(self.address, on_error=lambda error: print(error))
self._cluster_api = ClusterApiClient(self.address, on_error = lambda error: Logger.log("e", error))
return self._cluster_api

View file

@ -1,5 +1,6 @@
# Copyright (c) 2019 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
from typing import Dict, Optional, Callable, List
from UM import i18nCatalog
@ -66,7 +67,7 @@ class LocalClusterOutputDeviceManager:
## Add a networked printer manually by address.
def addManualDevice(self, address: str, callback: Optional[Callable[[bool, str], None]] = None) -> None:
api_client = ClusterApiClient(address, lambda error: print(error))
api_client = ClusterApiClient(address, lambda error: Logger.log("e", error))
api_client.getSystem(lambda status: self._onCheckManualDeviceResponse(address, status, callback))
## Remove a manually added networked printer.