diff options
Diffstat (limited to 'wqflask/utility')
-rw-r--r-- | wqflask/utility/logger.py | 16 | ||||
-rw-r--r-- | wqflask/utility/tools.py | 1 |
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() |