From 05384b2abbda45b543073553bdbde8e46fa46b21 Mon Sep 17 00:00:00 2001 From: Philip Trauner Date: Sun, 18 Dec 2016 23:21:05 +0100 Subject: [PATCH] Sped up, removed time, more colors! --- Shared/Logging.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Shared/Logging.py b/Shared/Logging.py index 8c4a1b3..6bd0e4d 100644 --- a/Shared/Logging.py +++ b/Shared/Logging.py @@ -3,6 +3,7 @@ from time import strftime from inspect import getmodule, stack, currentframe, getframeinfo from sys import stderr from sys import stdout +from threading import current_thread try: import sublime @@ -79,11 +80,16 @@ def print_out(message, color, file): module = getmodule(stack_[2][0]).__name__ CACHED_MODULES[stack_[2][0].f_code] = module if not print_fallback: - print("[%s] %s:%i → %s%s\033[0m" % (strftime("%H:%M:%S"), module, - stack_[2][0].f_lineno, color, message), file=file) + # Constants not used for performance reasons + # String is split so that lookup speed is improved + print("[\033[94m\033[40mfl0w\033[0m\033[0m]\033[96m " + "%s\033[0m:%i → %s%s\033[0m" % ( + module, stack_[2][0].f_lineno, color, message), + file=file) file.flush() else: - print("[%s] %s: %s" % (strftime("%H:%M:%S"), module, message)) + print("[fl0w] %s:%i → %s" % (module, + stack_[2][0].f_lineno, message)) def info(message, color=""): print_out(message, color, stdout)