Better logging. Errors without stacktrace are now printed to stderr

This commit is contained in:
ahmadbilalkhalid 2019-12-22 13:14:42 +05:00
commit e4d2c98fb5
4 changed files with 37 additions and 13 deletions

View file

@ -33,7 +33,6 @@ def readable_errors(func):
except etcd3.exceptions.ConnectionTimeoutError as err:
raise etcd3.exceptions.ConnectionTimeoutError('etcd connection timeout') from err
except Exception:
print('Some error occurred, most probably it is etcd that is erroring out.')
logger.exception('Some etcd error occurred')
return wrapper

View file

@ -36,6 +36,7 @@ def create_dev(script, _id, dev, ip=None):
try:
output = sp.check_output(command, stderr=sp.PIPE)
except Exception as e:
logger.exception('Creation of interface %s failed.', dev)
print(e)
return None
else:

View file

@ -51,7 +51,6 @@ class ImageStorageHandler(ABC):
output = sp.check_output(command, stderr=sp.PIPE)
except Exception as e:
if report:
print(e)
logger.exception(e)
return False
return True