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):
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