Added check debug logging with a file

This commit is contained in:
Adolfo Gómez García 2021-06-21 18:00:57 +02:00
parent 9e0fbca339
commit d51b22096e

View File

@ -33,16 +33,21 @@ from __future__ import unicode_literals
import logging import logging
import os import os
import os.path
import sys import sys
import tempfile import tempfile
LOGLEVEL = logging.INFO LOGLEVEL = logging.INFO
# Update debug level if uds-debug-on exists
if 'linux' in sys.platform or 'darwin' in sys.platform: if 'linux' in sys.platform or 'darwin' in sys.platform:
from os.path import expanduser # pylint: disable=ungrouped-imports logFile = os.path.expanduser('~/udsclient.log')
logFile = expanduser('~/udsclient.log') if os.path.isfile(os.path.expanduser('~/uds-debug-on')):
LOGLEVEL = logging.DEBUG
else: else:
logFile = os.path.join(tempfile.gettempdir(), 'udsclient.log') logFile = os.path.join(tempfile.gettempdir(), 'udsclient.log')
if os.path.isfile(os.path.join(tempfile.gettempdir(), 'uds-debug-on')):
LOGLEVEL = logging.DEBUG
try: try:
logging.basicConfig( logging.basicConfig(