32 lines
874 B
Python
32 lines
874 B
Python
|
terminal_colors = {
|
||
|
"RESET": "\033[0m",
|
||
|
"RED": "\033[1;31;40m",
|
||
|
"GREEN": "\033[1;32;40m",
|
||
|
"YELLOW": "\033[1;33;40m",
|
||
|
"BLUE": "\033[1;34;40m",
|
||
|
}
|
||
|
terminal_status = {
|
||
|
"ERROR": "RED",
|
||
|
"SUCCESS": "GREEN",
|
||
|
"WARNING": "YELLOW",
|
||
|
"INFO": "BLUE",
|
||
|
}
|
||
|
|
||
|
config = {
|
||
|
"date&time": True,
|
||
|
"format": "%H:%M:%S"
|
||
|
}
|
||
|
|
||
|
def customPrint(text, status):
|
||
|
print_start = f"{terminal_colors[terminal_status[status]]}{status}{terminal_colors['RESET']}: "
|
||
|
if config["date&time"]:
|
||
|
import datetime
|
||
|
now = datetime.datetime.now()
|
||
|
date_time = now.strftime(config["format"])
|
||
|
print_start = f"{terminal_colors[terminal_status[status]]}[{date_time}] {status}{terminal_colors['RESET']} : "
|
||
|
|
||
|
print_end = f"{terminal_colors['RESET']}"
|
||
|
print(f"{print_start}{text}{print_end}")
|
||
|
|
||
|
customPrint("Custom print function loaded", "INFO")
|