-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdebugLib.py
More file actions
36 lines (31 loc) · 1010 Bytes
/
debugLib.py
File metadata and controls
36 lines (31 loc) · 1010 Bytes
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
32
33
34
35
36
# Public project by Walter
#
# Custom printing library for debugging
# Enable developer print statements
traceActive = True
# Class containing colors i copied from somewhere
class color:
pink = '\033[95m'
blue = '\033[94m'
green = '\033[92m'
yellow = '\033[93m'
red = '\033[91m'
stopColor = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
# Colors for divisions
division_palette = {
"debug" : color.yellow,
"warn" : color.red,
"info" : color.blue,
}
# Custom printing function
def trace(division, message, devOnly=True):
if traceActive or not devOnly:
# Get corresponding color for division, if not found then pink.
textColor = division_palette.get(division, color.pink)
print("%s[%s]%s %s%s"%(textColor,
division,
" "*(8-len(division)),
message.replace("\n"," "),
color.stopColor))