From f69c43a8900ac55218ec0fc9a6c00cf654190d6d Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Sun, 25 Sep 2016 10:43:38 +0000 Subject: Logger: use output for assessing mapping parameters --- etc/default_settings.py | 1 + 1 file changed, 1 insertion(+) (limited to 'etc') diff --git a/etc/default_settings.py b/etc/default_settings.py index 9dddd0ad..fc79713c 100644 --- a/etc/default_settings.py +++ b/etc/default_settings.py @@ -7,6 +7,7 @@ # e.g. # # env LOG_SQL=True USE_REDIS=False ./bin/genenetwork2 +# env LOG_LEVEL=DEBUG ./bin/genenetwork2 ~/gn2_settings.py # # Note also that in the near future we will additionally fetch # settings from a JSON file -- cgit v1.2.3 From 1ab5479fa48d645f5b2e3899f7d5e568e4c6fcdc Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Mon, 26 Sep 2016 07:11:42 +0000 Subject: Settings: LOCAL_PRIVATE_FILES --- etc/default_settings.py | 1 + 1 file changed, 1 insertion(+) (limited to 'etc') diff --git a/etc/default_settings.py b/etc/default_settings.py index fc79713c..547478df 100644 --- a/etc/default_settings.py +++ b/etc/default_settings.py @@ -55,6 +55,7 @@ USE_GN_SERVER = 'False' # Use GN_SERVER SQL calls HOME=os.environ['HOME'] LOGFILE = HOME+"/genenetwork2.log" GENENETWORK_FILES = HOME+"/gn2_data" # base dir for all static data files +LOCAL_PRIVATE_FILES = HOME+"/gn2_private_data" # private static data files # ---- GN2 Executables PYLMM_COMMAND = str.strip(os.popen("which pylmm_redis").read()) -- cgit v1.2.3 From 7c065b65e11dc46f326fd492ca6dac37ee4d8d2f Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Thu, 6 Oct 2016 14:40:21 +0000 Subject: Logger: add more granular debug messages --- etc/default_settings.py | 2 +- wqflask/base/data_set.py | 3 ++- wqflask/utility/logger.py | 16 ++++++++++++++-- 3 files changed, 17 insertions(+), 4 deletions(-) (limited to 'etc') diff --git a/etc/default_settings.py b/etc/default_settings.py index 547478df..d8e57f38 100644 --- a/etc/default_settings.py +++ b/etc/default_settings.py @@ -42,7 +42,7 @@ WEBSERVER_BRANDING = None # Set the branding (nyi) WEBSERVER_DEPLOY = None # Deployment specifics (nyi) LOG_LEVEL = 'WARNING' # Logger mode (DEBUG|INFO|WARNING|ERROR|CRITICAL) -LOG_LEVEL_DEBUG = '0' # Debug log level (0-5, 0 = show all) +LOG_LEVEL_DEBUG = '0' # logger.debugf log level (0-5, 5 = show all) LOG_SQL = 'False' # Log SQL/backend and GN_SERVER calls LOG_SQLALCHEMY = 'False' LOG_BENCH = True # Log bench marks diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py index 8bd5bfb9..fddfce58 100644 --- a/wqflask/base/data_set.py +++ b/wqflask/base/data_set.py @@ -107,7 +107,8 @@ Publish or ProbeSet. E.g. else: new_type = "ProbeSet" self.datasets[short_dataset_name] = new_type - logger.debug("datasets",self.datasets) + # Set LOG_LEVEL_DEBUG=5 to see the following: + logger.debugf(5,"datasets",self.datasets) def __call__(self, name): return self.datasets[name] diff --git a/wqflask/utility/logger.py b/wqflask/utility/logger.py index b873e16f..bacb0aa4 100644 --- a/wqflask/utility/logger.py +++ b/wqflask/utility/logger.py @@ -50,11 +50,20 @@ class GNLogger: self.logger.setLevel(value) def debug(self,*args): + """Call logging.debug for multiple args. Use (lazy) debugf and +level=num to filter on LOG_LEVEL_DEBUG. + + """ + self.collect(self.logger.debug,*args) + + def debug20(self,*args): """Call logging.debug for multiple args. Use level=num to filter on LOG_LEVEL_DEBUG (NYI). """ - self.collect(self.logger.debug,*args) + if level <= LOG_LEVEL_DEBUG: + if self.logger.getEffectiveLevel() < 20: + self.collect(self.logger.debug,*args) def info(self,*args): """Call logging.info for multiple args""" @@ -79,7 +88,10 @@ LOG_LEVEL_DEBUG (NYI). self.collectf(self.logger.debug,*args) def debugf(self,level=0,*args): - """Call logging.debug for multiple args lazily""" + """Call logging.debug for multiple args lazily and handle + LOG_LEVEL_DEBUG correctly + + """ # only evaluate function when logging if level <= LOG_LEVEL_DEBUG: if self.logger.getEffectiveLevel() < 20: -- cgit v1.2.3