diff --git a/consumerlocator.py b/consumerlocator.py index ee1ee9c..b11a4cc 100644 --- a/consumerlocator.py +++ b/consumerlocator.py @@ -8,6 +8,7 @@ import datetime from communicator import Communicator import os from redisconnector import RedisConnector +import logging __author__ = "@dscharnitzky" __copyright__ = "Copyright 2020, GoldenPogácsa Team" @@ -15,7 +16,7 @@ __module_name__ = "consumerlocator" __version__text__ = "1" KNOWNCONSUMER = os.getenv("PRODUCER_KNOWNCONSUMER", '10.69.42.1') - +LOGGER = logging.getLogger(__name__) class ConsumerLocator: @@ -59,6 +60,7 @@ class ConsumerLocator: contains = True if not contains: + LOGGER.info(f"Learned about new consumer at {recconsumer}") consumer_list.append({"Host": recconsumer, "State": True, "LastOk": datetime.datetime.now().timestamp()}) self.red.consumerlist = consumer_list @@ -109,6 +111,7 @@ class ConsumerLocator: self.red.currentconsumer = newcurrentconsumer if self.red.currentconsumer is not None: + LOGGER.warning(f"Falling back to consumer at {newcurrentconsumer['Host']}") self.learnconsumerlist() if self.red.currentconsumer is not None: