aboutsummaryrefslogtreecommitdiff
path: root/wqflask/utility
diff options
context:
space:
mode:
authorPjotr Prins2016-06-21 10:00:07 +0000
committerPjotr Prins2016-06-21 10:00:07 +0000
commit9bf8923f05b8f2f2edf2620cc7648094d63df5d9 (patch)
tree856a6c87b778b265028e101696fbd8b28b92293e /wqflask/utility
parent68e86bda88b948d4de858b1ef1855789f30a1074 (diff)
downloadgenenetwork2-9bf8923f05b8f2f2edf2620cc7648094d63df5d9.tar.gz
Use logger also for benchmarking
Diffstat (limited to 'wqflask/utility')
-rw-r--r--wqflask/utility/benchmark.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/wqflask/utility/benchmark.py b/wqflask/utility/benchmark.py
index 887b3d88..8c97370d 100644
--- a/wqflask/utility/benchmark.py
+++ b/wqflask/utility/benchmark.py
@@ -5,6 +5,8 @@ import inspect
import time
from utility.tools import LOG_BENCH
+from utility.logger import getLogger
+logger = getLogger(__name__ )
class Bench(object):
entries = collections.OrderedDict()
@@ -16,9 +18,9 @@ class Bench(object):
def __enter__(self):
if self.write_output:
if self.name:
- print("Starting benchmark: %s" % (self.name))
+ logger.debug("Starting benchmark: %s" % (self.name))
else:
- print("Starting benchmark at: %s [%i]" % (inspect.stack()[1][3], inspect.stack()[1][2]))
+ logger.debug("Starting benchmark at: %s [%i]" % (inspect.stack()[1][3], inspect.stack()[1][2]))
self.start_time = time.time()
def __exit__(self, type, value, traceback):
@@ -29,7 +31,7 @@ class Bench(object):
else:
name = "That"
- print(" %s took: %f seconds" % (name, (time_taken)))
+ logger.info(" %s took: %f seconds" % (name, (time_taken)))
if self.name:
Bench.entries[self.name] = Bench.entries.get(self.name, 0) + time_taken