From e6f6aaa7de439ac6e454d9b26d2760ded8dc4923 Mon Sep 17 00:00:00 2001 From: Ron Freimann <42897796+rongardF@users.noreply.github.com> Date: Tue, 13 Sep 2022 07:20:40 +0300 Subject: [PATCH] Doc about logger and changed logger method call --- tvDatafeed/datafeed.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tvDatafeed/datafeed.py b/tvDatafeed/datafeed.py index 993f91b..1d603af 100644 --- a/tvDatafeed/datafeed.py +++ b/tvDatafeed/datafeed.py @@ -394,7 +394,8 @@ def _main_loop(self): # consumer threads that are added for that particular Seis. # # If fail to retrieve data then retry up to RETRY_LIMIT times - # and if still fail then raise ValueError. + # and if still fail then log the event (critical) and close + # down the consumer threads and the main loop itself. while self._sat.wait(): # waits until soonest expiry and returns True; returns False if closed with self._lock: @@ -410,7 +411,7 @@ def _main_loop(self): time.sleep(0.1) # little time before retrying else: # limit reached, print an error into logs and gracefully shut down the main loop and consumer threads self._sat.quit() - logger.exception("Failed to retrieve new data from TradingView", exc_info=True) + logger.critical("Failed to retrieve new data from TradingView") # push new data into all consumers that are expecting data for this Seis for consumer in seis.get_consumers(): @@ -484,4 +485,4 @@ def del_tvdatafeed(self): ''' if self._main_thread is not None: self.__del__() - \ No newline at end of file +