1
0

logging: make console log lines shorter

This commit is contained in:
SomberNight
2019-04-27 03:42:31 +02:00
parent f22a23aaf2
commit a7b13f4876
5 changed files with 28 additions and 8 deletions

View File

@@ -342,13 +342,14 @@ def constant_time_compare(val1, val2):
# decorator that prints execution time
_profiler_logger = _logger.getChild('profiler')
def profiler(func):
def do_profile(args, kw_args):
name = func.__qualname__
t0 = time.time()
o = func(*args, **kw_args)
t = time.time() - t0
_logger.debug(f"[profiler] {name} {t:,.4f}")
_profiler_logger.debug(f"{name} {t:,.4f}")
return o
return lambda *args, **kw_args: do_profile(args, kw_args)