Sped up, removed time, more colors!

This commit is contained in:
Philip Trauner 2016-12-18 23:21:05 +01:00
parent 0934f6fe69
commit 05384b2abb

View file

@ -3,6 +3,7 @@ from time import strftime
from inspect import getmodule, stack, currentframe, getframeinfo from inspect import getmodule, stack, currentframe, getframeinfo
from sys import stderr from sys import stderr
from sys import stdout from sys import stdout
from threading import current_thread
try: try:
import sublime import sublime
@ -79,11 +80,16 @@ def print_out(message, color, file):
module = getmodule(stack_[2][0]).__name__ module = getmodule(stack_[2][0]).__name__
CACHED_MODULES[stack_[2][0].f_code] = module CACHED_MODULES[stack_[2][0].f_code] = module
if not print_fallback: if not print_fallback:
print("[%s] %s:%i%s%s\033[0m" % (strftime("%H:%M:%S"), module, # Constants not used for performance reasons
stack_[2][0].f_lineno, color, message), file=file) # 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() file.flush()
else: 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=""): def info(message, color=""):
print_out(message, color, stdout) print_out(message, color, stdout)