-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmonkDebug.py
75 lines (62 loc) · 1.49 KB
/
monkDebug.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/python
import os
debugLevel=3
debugColor=False
color_default= ""
color_red = ""
color_green = ""
color_yellow = ""
color_blue = ""
color_purple = ""
color_cyan = ""
def set_level(id):
global debugLevel
debugLevel = id
def enable_color():
global debugColor
debugColor = True
global color_default
color_default= "\033[00m"
global color_red
color_red = "\033[31m"
global color_green
color_green = "\033[32m"
global color_yellow
color_yellow = "\033[33m"
global color_blue
color_blue = "\033[34m"
global color_purple
color_purple = "\033[35m"
global color_cyan
color_cyan = "\033[36m"
def verbose(input):
global debugLock
global debugLevel
if debugLevel >= 5:
print(color_blue + input + color_default)
def debug(input):
global debugLock
global debugLevel
if debugLevel >= 4:
print(color_green + input + color_default)
def info(input):
global debugLock
global debugLevel
if debugLevel >= 3:
print(input + color_default)
def warning(input):
global debugLock
global debugLevel
if debugLevel >= 2:
print(color_purple + "[WARNING] " + input + color_default)
def error(input, threadID=-1):
global debugLock
global debugLevel
if debugLevel >= 1:
print(color_red + "[ERROR] " + input + color_default)
exit(-1)
def print_element(type, lib, dir, name):
global debugLock
global debugLevel
if debugLevel >= 3:
print(color_cyan + type + color_default + " : " + color_yellow + lib + color_default + " " + dir + " " + color_blue + name + color_default)