-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlogger.py
More file actions
30 lines (29 loc) · 1.1 KB
/
Copy pathlogger.py
File metadata and controls
30 lines (29 loc) · 1.1 KB
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
from constants import Colors
import time
def logger(message, log_time = True, level="INFO"):
now = time
if level == "INFO":
color = Colors.GREEN
str = f"[{now.strftime('%Y-%m-%d %H:%M:%S')}] {color}{message}{Colors.RESET}"
print(str)
elif level == "EXE_START": #코드 실행중일때
color = Colors.YELLOW
str = f"[{now.strftime('%Y-%m-%d %H:%M:%S')}] {color}{message}{Colors.RESET}"
print(str)
elif level == "EXE_FINISH":
color = Colors.MAGENTA
str = f"[{now.strftime('%Y-%m-%d %H:%M:%S')}] {color}{message}{Colors.RESET}"
print(str)
elif level == "ERROR":
color = Colors.RED
str = f"[{now.strftime('%Y-%m-%d %H:%M:%S')}] {color}{message}{Colors.RESET}"
print(str)
elif level == "DEBUG":
color = Colors.BLUE
str = f"[{now.strftime('%Y-%m-%d %H:%M:%S')}] {color}{message}{Colors.RESET}"
print(str)
else:
print("CHECK LOG SYNTAX")
color = Colors.BLUE
str = f"[{now.strftime('%Y-%m-%d %H:%M:%S')}] {color}{message}{Colors.RESET}"
print(str)