mirror of
https://github.com/Jylpah/blitz-tools.git
synced 2026-10-23 11:09:52 +02:00
Better info printing for worker threads
This commit is contained in:
1 parent
38d6662c7c
commit
bdfacdf51a
1 file changed
+17
-7
+17
-7
@@ -44,20 +44,27 @@ def setSilent(silent: bool):
|
|||||||
VERBOSE = False
|
VERBOSE = False
|
||||||
DEBUG = False
|
DEBUG = False
|
||||||
|
|
||||||
def verbose(msg = ""):
|
def verbose(msg = "", n = None):
|
||||||
"""Print a message"""
|
"""Print a message"""
|
||||||
if VERBOSE:
|
if VERBOSE:
|
||||||
print(msg)
|
if n == None:
|
||||||
|
print(msg)
|
||||||
|
else:
|
||||||
|
print('[' + str(n) + ']: ' + msg)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def verbose_std(msg = ""):
|
def verbose_std(msg = "", n = None):
|
||||||
"""Print a message"""
|
"""Print a message"""
|
||||||
if not SILENT:
|
if not SILENT:
|
||||||
print(msg)
|
if n == None:
|
||||||
|
print(msg)
|
||||||
|
else:
|
||||||
|
print('[' + str(n) + ']: ' + msg)
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def printWaiter(force = False):
|
def printWaiter(force = False):
|
||||||
if not DEBUG and (not SILENT or force):
|
if not DEBUG and (not SILENT or force):
|
||||||
print('.', end='', flush=True)
|
print('.', end='', flush=True)
|
||||||
|
|
||||||
|
|
||||||
@@ -66,13 +73,16 @@ def printNewline(force = False):
|
|||||||
print('', flush=True)
|
print('', flush=True)
|
||||||
|
|
||||||
|
|
||||||
def debug(msg = ""):
|
def debug(msg = "", n = None):
|
||||||
"""print a conditional debug message"""
|
"""print a conditional debug message"""
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
curframe = inspect.currentframe()
|
curframe = inspect.currentframe()
|
||||||
calframe = inspect.getouterframes(curframe, 2)
|
calframe = inspect.getouterframes(curframe, 2)
|
||||||
caller = calframe[1][3]
|
caller = calframe[1][3]
|
||||||
print('DEBUG: ' + caller + '(): ' + msg)
|
if n == None:
|
||||||
|
print('DEBUG: ' + caller + '(): ' + msg)
|
||||||
|
else:
|
||||||
|
print('DEBUG: ' + caller + '()' + '[' + str(n) + ']: ' + msg)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user