projects
/
tabakrolletjie.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b3a98c5
)
Allow turning on just a single debug point.
author
Simon Cross
<hodgestar@gmail.com>
Wed, 7 Sep 2016 19:20:22 +0000
(21:20 +0200)
committer
Simon Cross
<hodgestar@gmail.com>
Wed, 7 Sep 2016 19:20:22 +0000
(21:20 +0200)
tabakrolletjie/utils.py
patch
|
blob
|
history
diff --git
a/tabakrolletjie/utils.py
b/tabakrolletjie/utils.py
index bc5aef2572cf42e3c7ba20146fe2bd80f45974ad..b605ba15f8b6287a82be2e3943c9194fb30c8b9f 100644
(file)
--- 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