on master help sign in
[enh] logging added
commit6cbd29f674c1a4c585ea4e6b208ab9d53a141ee7 authorAdam Tauber <asciimoo@gmail.com> dateFri 9 Jan 2015, 04:01 (12 years ago) parent3b67203
1 file changed+11−1
searx/__init__.py+11−1
searx/__init__.py+11−1
@@ -15,9 +15,9 @@ along with searx. If not, see < http://www.gnu.org/licenses/ >.
1515(C) 2013- by Adam Tauber, <asciimoo@gmail.com>
1616'''
1717
18+import logging
1819from os import environ
1920from os.path import realpath, dirname, join, abspath
20−from searx.https_rewrite import load_https_rules
2121try:
2222 from yaml import load
2323except:
@@ -45,7 +45,17 @@ else:
4545with open(settings_path) as settings_yaml:
4646 settings = load(settings_yaml)
4747
48+if settings.get('server', {}).get('debug'):
49+ logging.basicConfig(level=logging.DEBUG)
50+else:
51+ logging.basicConfig(level=logging.WARNING)
52+
53+logger = logging.getLogger('searx')
54+
4855# load https rules only if https rewrite is enabled
4956if settings.get('server', {}).get('https_rewrite'):
5057 # loade https rules
58+ from searx.https_rewrite import load_https_rules
5159 load_https_rules(https_rewrite_path)
60+
61+logger.info('Initialisation done')