-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.py
32 lines (27 loc) · 952 Bytes
/
utils.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# utils.py
import logging
from termcolor import colored
#from pprint import pp
import pprint
logger = logging.getLogger(__name__)
def handle_error(e, func, message, errors, key):
logger.error(f"{func} {message}")
logger.error(f"{func} Error message: {str(e)}")
logger.debug(f"{func} Error type: {type(e)}")
errors[key] = str(e) # Store the error message in the dictionary
def output_errors(errors, calling_func=None):
if len(errors) == 0:
print(f"[main-{calling_func}]: complete")
print(colored("ERRORS:", "green"))
print("None")
return
print(f"[main-{calling_func}]: complete - errors reported")
print(colored("ERRORS:", "red"))
pprint.pprint(errors)
def output_output(output):
if len(output) == 0:
print(colored("OUTPUT:", "blue"))
print("None")
return
print(colored("OUTPUT:", "blue"))
pprint.pprint(output)