Fixing up client

This commit is contained in:
Adolfo Gómez García 2021-06-23 15:58:37 +02:00
parent 97841d655b
commit 4424f2a497
2 changed files with 6 additions and 2 deletions

View File

@ -47,7 +47,7 @@ from uds.rest import RestApi, RetryException, InvalidVersion, UDSException
from uds.forward import forward # type: ignore
from uds.tunnel import forward as f2 # type: ignore
from uds.log import logger
from uds.log import logger, DEBUG
from uds import tools
from uds import VERSION
@ -174,7 +174,8 @@ class UDSClient(QtWidgets.QMainWindow):
# Retry operation in ten seconds
QtCore.QTimer.singleShot(10000, self.getTransportData)
except Exception as e:
# logger.exception('Got exception on getTransportData')
if DEBUG:
logger.exception('Got exception on getTransportData')
self.showError(e)
def start(self):

View File

@ -38,16 +38,19 @@ import sys
import tempfile
LOGLEVEL = logging.INFO
DEBUG = False
# Update debug level if uds-debug-on exists
if 'linux' in sys.platform or 'darwin' in sys.platform:
logFile = os.path.expanduser('~/udsclient.log')
if os.path.isfile(os.path.expanduser('~/uds-debug-on')):
LOGLEVEL = logging.DEBUG
DEBUG = True
else:
logFile = os.path.join(tempfile.gettempdir(), 'udsclient.log')
if os.path.isfile(os.path.join(tempfile.gettempdir(), 'uds-debug-on')):
LOGLEVEL = logging.DEBUG
DEBUG = True
try:
logging.basicConfig(