Skip to content

Commit

Permalink
Doc about logger and changed logger method call
Browse files Browse the repository at this point in the history
  • Loading branch information
rongardF authored Sep 13, 2022
1 parent 9a37dfb commit e6f6aaa
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tvDatafeed/datafeed.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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():
Expand Down Expand Up @@ -484,4 +485,4 @@ def del_tvdatafeed(self):
'''
if self._main_thread is not None:
self.__del__()


0 comments on commit e6f6aaa

Please sign in to comment.