fix: [modules] print + save traceback in logs

pull/569/head
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
1 changed files with 10 additions and 0 deletions

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