-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdebug.py
More file actions
68 lines (45 loc) · 1.37 KB
/
debug.py
File metadata and controls
68 lines (45 loc) · 1.37 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
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
import sys
class ThisModule(sys.__class__):
@property
def quiet(self) -> int:
return self._quiet
@quiet.setter
def quiet(self, value: int) -> None:
self._quiet = value
sys.modules[__name__].__class__ = ThisModule
KOFTA_VERSION = "0.10"
CBLK = "\x1b[0;30m"
CRED = "\x1b[0;31m"
CGRN = "\x1b[0;32m"
CBRN = "\x1b[0;33m"
CBLU = "\x1b[0;34m"
CMGN = "\x1b[0;35m"
CCYA = "\x1b[0;36m"
CLGR = "\x1b[0;37m"
CGRA = "\x1b[1;90m"
CLRD = "\x1b[1;91m"
CLGN = "\x1b[1;92m"
CYEL = "\x1b[1;93m"
CLBL = "\x1b[1;94m"
CPIN = "\x1b[1;95m"
CLCY = "\x1b[1;96m"
CBRI = "\x1b[1;97m"
CRST = "\x1b[0m"
_quiet: int = 0
def psay(msg: str, /, *args, **kwargs) -> None:
print(msg, file=sys.stderr, flush=True, *args, **kwargs)
def pwarn(msg: str, /, *args, **kwargs) -> None:
if _quiet < 2:
psay(f"{CYEL}[!] {CBRI}WARNING: {CRST}{msg}", *args, **kwargs)
def pact(msg: str, /, *args, **kwargs) -> None:
if _quiet < 3:
psay(f"{CGRN}[*] {CRST}{msg}", *args, **kwargs)
def pok(msg: str, /, *args, **kwargs) -> None:
if _quiet < 3:
psay(f"{CGRN}[+] {CRST}{msg}", *args, **kwargs)
def pfatal(msg: str, /, *args, **kwargs) -> None:
if _quiet < 4:
psay(f"{CRED}[-] {CBRI}PROGRAM ABORT: {CRST}{msg}", *args, **kwargs)
sys.exit(1)
def phello(prog: str) -> None:
psay(f"{CCYA}{prog} {CBRI}{KOFTA_VERSION}{CRST} by <me@alardutp.dev>\n")