mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-22 22:27:17 +00:00
fix: [modules] print + save traceback in logs
This commit is contained in:
parent
2f52bdb9af
commit
fc11c1769b
1 changed files with 10 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue