Fixed some bugs
This commit is contained in:
+29
-1
@@ -5,8 +5,22 @@ import re
|
||||
|
||||
from core.tokenizer import TokenKind
|
||||
|
||||
default_debug_name = "*default*"
|
||||
debug_activated = set()
|
||||
|
||||
|
||||
def my_debug(*args, check_started=None):
|
||||
if check_started and default_debug_name not in debug_activated:
|
||||
return
|
||||
|
||||
if isinstance(check_started, str) and check_started not in debug_activated:
|
||||
return
|
||||
|
||||
if isinstance(check_started, list):
|
||||
for debug_name in check_started:
|
||||
if debug_name not in debug_activated:
|
||||
return
|
||||
|
||||
def my_debug(*args):
|
||||
with open("debug.txt", "a") as f:
|
||||
for arg in args:
|
||||
if isinstance(arg, list):
|
||||
@@ -16,6 +30,20 @@ def my_debug(*args):
|
||||
f.write(f"{arg}\n")
|
||||
|
||||
|
||||
def start_debug(msg=None, debug_name=default_debug_name):
|
||||
debug_activated.add(debug_name)
|
||||
if msg:
|
||||
with open("debug.txt", "a") as f:
|
||||
f.write(f"{msg}\n")
|
||||
|
||||
|
||||
def stop_debug(msg=None, debug_name=default_debug_name):
|
||||
if msg:
|
||||
with open("debug.txt", "a") as f:
|
||||
f.write(f"{msg}\n")
|
||||
debug_activated.remove(debug_name)
|
||||
|
||||
|
||||
def sysarg_to_string(argv):
|
||||
"""
|
||||
Transform a list of strings into a single string
|
||||
|
||||
Reference in New Issue
Block a user