From bdfacdf51a7ea4ffcf3551ee40d8b66febf690ee Mon Sep 17 00:00:00 2001 From: Jylpah Date: Thu, 19 Sep 2019 22:38:12 +0300 Subject: [PATCH] Better info printing for worker threads --- blitzutils.py | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/blitzutils.py b/blitzutils.py index dc59458..5e53a69 100644 --- a/blitzutils.py +++ b/blitzutils.py @@ -44,20 +44,27 @@ def setSilent(silent: bool): VERBOSE = False DEBUG = False -def verbose(msg = ""): +def verbose(msg = "", n = None): """Print a message""" if VERBOSE: - print(msg) + if n == None: + print(msg) + else: + print('[' + str(n) + ']: ' + msg) return None -def verbose_std(msg = ""): +def verbose_std(msg = "", n = None): """Print a message""" if not SILENT: - print(msg) + if n == None: + print(msg) + else: + print('[' + str(n) + ']: ' + msg) + return None def printWaiter(force = False): - if not DEBUG and (not SILENT or force): + if not DEBUG and (not SILENT or force): print('.', end='', flush=True) @@ -66,13 +73,16 @@ def printNewline(force = False): print('', flush=True) -def debug(msg = ""): +def debug(msg = "", n = None): """print a conditional debug message""" if DEBUG: curframe = inspect.currentframe() calframe = inspect.getouterframes(curframe, 2) caller = calframe[1][3] - print('DEBUG: ' + caller + '(): ' + msg) + if n == None: + print('DEBUG: ' + caller + '(): ' + msg) + else: + print('DEBUG: ' + caller + '()' + '[' + str(n) + ']: ' + msg) return None