fix: [modules] print + save traceback in logs

This commit is contained in:
Terrtia 2021-06-07 15:08:39 +02:00
parent 2f52bdb9af
commit fc11c1769b
No known key found for this signature in database
GPG key ID: 1E1B1F50D84613D0

View file

@ -8,6 +8,7 @@ Base Class for AIL Modules
##################################
from abc import ABC, abstractmethod
import time
import traceback
##################################
# Import Project packages
@ -87,7 +88,16 @@ class AbstractModule(ABC):
# Module processing with the message from the queue
self.compute(message)
except Exception as err:
trace = traceback.format_tb(err.__traceback__)
self.redis_logger.critical(f"Error in module {self.module_name}: {err}")
self.redis_logger.critical(trace)
print()
print(f"ERROR: {err}")
print(f'MESSAGE: {message}')
print('TRACEBACK:')
for line in trace:
print(line)
else:
self.computeNone()
# Wait before next process