add more logging
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Torma Kristóf 2020-04-01 02:05:15 +02:00
parent de64ef0e41
commit 65db908fb6

View File

@ -35,8 +35,9 @@ class Communicator:
:return: none
"""
currentconsumer=self.currenctconsumer
LOGGER.debug(f"Sending message to {currentconsumer}")
requests.post(f'http://{currentconsumer}/log', json={'uuid': self.uuid, 'message': message})
LOGGER.info(f"Sending message to {currentconsumer}")
postresponse=requests.post(f'http://{currentconsumer}/log', json={'uuid': self.uuid, 'message': message})
LOGGER.debug(f"Message status code is:{postresponse.status_code}")
def discoveravailableconsumers(self) -> list:
"""
@ -47,7 +48,7 @@ class Communicator:
currentconsumer = self.currenctconsumer
response = requests.get(f'http://{currentconsumer}/consumer')
json = response.json()
LOGGER.debug(f"List of currently available consumers: {json}")
LOGGER.info(f"List of currently available consumers: {json}")
return json
except Exception:
return []
@ -64,7 +65,7 @@ class Communicator:
except Exception as e:
LOGGER.exception(e)
isavailable = False
LOGGER.debug(f"Current consumer availability: {isavailable}")
LOGGER.info(f"Current consumer availability: {isavailable}")
return isavailable
def checkconsumer(self, consumer: str) -> bool:
@ -79,7 +80,7 @@ class Communicator:
except Exception as e:
LOGGER.exception(e)
isavailable = False
LOGGER.debug(f"Consumer {consumer} availability: {isavailable}")
LOGGER.info(f"Consumer {consumer} availability: {isavailable}")
return isavailable
def set_currentconsumer(self,currenctconsumer):