aboutsummaryrefslogtreecommitdiff
path: root/wqflask/utility
diff options
context:
space:
mode:
authorPjotr Prins2016-06-19 16:03:26 +0000
committerPjotr Prins2016-06-19 16:03:26 +0000
commitaae827674cdbe46c7f1ce5d2246bf485a24dbbb3 (patch)
treef6a106c6544c8d68aae29b8a2e3e1ceb3de648b3 /wqflask/utility
parent2214650621ee57b4c427bf8b5cab1128eb06db93 (diff)
downloadgenenetwork2-aae827674cdbe46c7f1ce5d2246bf485a24dbbb3.tar.gz
gn_server: SQL handling
Diffstat (limited to 'wqflask/utility')
-rw-r--r--wqflask/utility/logger.py16
-rw-r--r--wqflask/utility/tools.py1
2 files changed, 14 insertions, 3 deletions
diff --git a/wqflask/utility/logger.py b/wqflask/utility/logger.py
index bc0578c9..0d374f1a 100644
--- a/wqflask/utility/logger.py
+++ b/wqflask/utility/logger.py
@@ -62,14 +62,24 @@ class GNLogger:
"""Call logging.error for multiple args"""
self.collect(self.logger.error,*args)
+ def infof(self,*args):
+ """Call logging.info for multiple args lazily"""
+ # only evaluate function when logging
+ if self.logger.getEffectiveLevel() < 30:
+ self.collectf(self.logger.debug,*args)
+
def debugf(self,*args):
"""Call logging.debug for multiple args lazily"""
- if self.logger.getEffectiveLevel() <= 10:
- self.debug("Calling debug function!")
+ # only evaluate function when logging
+ if self.logger.getEffectiveLevel() < 20:
self.collectf(self.logger.debug,*args)
- def sql(self, sqlcommand, fun = None):
+ def sql(self, description, sqlcommand, fun = None):
"""Log SQL command, optionally invoking a timed fun"""
+ self.info(description,sqlcommand)
+ if fun:
+ self.info("Invoking function")
+ return fun(sqlcommand)
def collect(self,fun,*args):
"""Collect arguments and use fun to output one by one"""
diff --git a/wqflask/utility/tools.py b/wqflask/utility/tools.py
index 2affd130..fca5917e 100644
--- a/wqflask/utility/tools.py
+++ b/wqflask/utility/tools.py
@@ -172,6 +172,7 @@ LOG_LEVEL = get_setting('LOG_LEVEL')
LOG_LEVEL_DEBUG = get_setting_int('LOG_LEVEL_DEBUG')
LOG_SQL = get_setting_bool('LOG_SQL')
USE_REDIS = get_setting_bool('USE_REDIS')
+USE_GN_SERVER = get_setting_bool('USE_GN_SERVER')
PYLMM_COMMAND = pylmm_command()
GEMMA_COMMAND = gemma_command()