From bdccb9539691f4fd9a48d3a2c6499a1644e87f11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alin=20Tr=C4=83istaru?= Date: Fri, 28 Apr 2017 22:02:59 +0300 Subject: [PATCH 1/3] remove duplicate debug message --- scripts/debug.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/debug.py b/scripts/debug.py index 67660b4..2e6339c 100644 --- a/scripts/debug.py +++ b/scripts/debug.py @@ -32,8 +32,6 @@ finally: RESET = '' BOLD = '' UNDERLINE = '' - finally: - config.debug and print(colors.HEADER + "=== DEBUG ENABLED ===") def fnCall(): """ From 580cb84d3b83c54b977fc5e20562ed2aa218ae1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alin=20Tr=C4=83istaru?= Date: Fri, 28 Apr 2017 22:03:41 +0300 Subject: [PATCH 2/3] remove ANSI color codes from log file --- scripts/gen.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/gen.py b/scripts/gen.py index 6d436a9..dc21d80 100644 --- a/scripts/gen.py +++ b/scripts/gen.py @@ -43,12 +43,16 @@ def log(message, info=True, error=False, debug=False): datefmt='%H:%M:%S', level=logging.DEBUG) print(message) + + # remove ANSI color codes from logs + message_clean = re.compile(r'\x1b[^m]*m').sub('', message) + if info is True: - logging.info(message) + logging.info(message_clean) elif error is not False: - logging.error(message) + logging.error(message_clean) elif debug is not False: - logging.debug(message) + logging.debug(message_clean) def resource_path(relativePath): From fd98b9082f52f200f7b1568fc28a70d4cb56b285 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alin=20Tr=C4=83istaru?= Date: Fri, 28 Apr 2017 22:15:35 +0300 Subject: [PATCH 3/3] clean up logging timeformat --- scripts/gen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/gen.py b/scripts/gen.py index dc21d80..adba561 100644 --- a/scripts/gen.py +++ b/scripts/gen.py @@ -39,7 +39,7 @@ def log(message, info=True, error=False, debug=False): os.remove(LOG_FILE_PATH) logging.basicConfig(filename=LOG_FILE_PATH, filemode='a', - format='%(asctime)s,%(msecs)d %(name)s %(levelname)s %(message)s', + format='%(asctime)s.%(msecs)03d %(name)s %(levelname)s %(message)s', datefmt='%H:%M:%S', level=logging.DEBUG) print(message)