From 2dc2a3172f0b9a28bb5b688926be1a9e10213512 Mon Sep 17 00:00:00 2001 From: Simon Cross Date: Wed, 7 Sep 2016 21:20:22 +0200 Subject: [PATCH] Allow turning on just a single debug point. --- tabakrolletjie/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tabakrolletjie/utils.py b/tabakrolletjie/utils.py index bc5aef2..b605ba1 100644 --- a/tabakrolletjie/utils.py +++ b/tabakrolletjie/utils.py @@ -6,7 +6,7 @@ import time from .constants import DEBUG -def debug_timer(label): +def debug_timer(label, debug=False): """ A decorator for printing how long a function took if debug is true. """ def debug_inner(f): @@ -17,7 +17,7 @@ def debug_timer(label): return f(*args, **kw) finally: duration = time.time() - start_time - if DEBUG: + if DEBUG or debug: print "%s [%g seconds]" % (label, duration) return wrapper return debug_inner -- 2.34.1