aboutsummaryrefslogtreecommitdiff
path: root/wqflask/utility/tools.py
diff options
context:
space:
mode:
authorPjotr Prins2016-06-18 12:14:39 +0000
committerPjotr Prins2016-06-18 12:14:39 +0000
commit21d14548c6c3799f36f0997a30a3853344dcc96b (patch)
tree53059df70834c8758e6a7e8653dbd3881451cb95 /wqflask/utility/tools.py
parent574aee1d78d1633249cc359e8d91075762365074 (diff)
downloadgenenetwork2-21d14548c6c3799f36f0997a30a3853344dcc96b.tar.gz
Logging settings
Diffstat (limited to 'wqflask/utility/tools.py')
-rw-r--r--wqflask/utility/tools.py25
1 files changed, 24 insertions, 1 deletions
diff --git a/wqflask/utility/tools.py b/wqflask/utility/tools.py
index 1b31857e..bfb379f2 100644
--- a/wqflask/utility/tools.py
+++ b/wqflask/utility/tools.py
@@ -50,7 +50,7 @@ def get_setting(command_id,guess=None):
command = value(guess)
if command == None or command == "":
raise Exception(command_id+' setting unknown or faulty (update default_settings.py?).')
- logger.info("Set "+command_id+"="+str(command))
+ logger.debug("Set "+command_id+"="+str(command))
return command
def get_setting_bool(id):
@@ -143,6 +143,29 @@ def locate_ignore_error(name, subdir=None):
def tempdir():
return valid_path(get_setting("TEMPDIR","/tmp"))
+BLUE = '\033[94m'
+GREEN = '\033[92m'
+BOLD = '\033[1m'
+ENDC = '\033[0m'
+
+def show_settings():
+ from utility.tools import LOG_LEVEL
+
+ print("Set global log level to "+BLUE+LOG_LEVEL+ENDC)
+ log_level = getattr(logging, LOG_LEVEL.upper())
+ logging.basicConfig(level=log_level)
+
+ logger.info(BLUE+"Mr. Mojo Risin 2"+ENDC)
+ print "runserver.py: ****** The webserver has the following configuration ******"
+ keylist = app.config.keys()
+ keylist.sort()
+ for k in keylist:
+ try:
+ print("%s %s%s%s%s" % (k,BLUE,BOLD,get_setting(k),ENDC))
+ except:
+ print("%s %s%s%s%s" % (k,GREEN,BOLD,app.config[k],ENDC))
+
+
# Cached values
WEBSERVER_MODE = get_setting('WEBSERVER_MODE')
LOG_LEVEL = get_setting('LOG_LEVEL')