1
0
mirror of https://github.com/searx/searx synced 2024-12-12 16:56:47 +01:00

[enh] logging added

This commit is contained in:
Adam Tauber 2015-01-09 04:01:31 +01:00
parent 3b672039aa
commit 6cbd29f674

View File

@ -15,9 +15,9 @@ along with searx. If not, see < http://www.gnu.org/licenses/ >.
(C) 2013- by Adam Tauber, <asciimoo@gmail.com> (C) 2013- by Adam Tauber, <asciimoo@gmail.com>
''' '''
import logging
from os import environ from os import environ
from os.path import realpath, dirname, join, abspath from os.path import realpath, dirname, join, abspath
from searx.https_rewrite import load_https_rules
try: try:
from yaml import load from yaml import load
except: except:
@ -45,7 +45,17 @@ else:
with open(settings_path) as settings_yaml: with open(settings_path) as settings_yaml:
settings = load(settings_yaml) settings = load(settings_yaml)
if settings.get('server', {}).get('debug'):
logging.basicConfig(level=logging.DEBUG)
else:
logging.basicConfig(level=logging.WARNING)
logger = logging.getLogger('searx')
# load https rules only if https rewrite is enabled # load https rules only if https rewrite is enabled
if settings.get('server', {}).get('https_rewrite'): if settings.get('server', {}).get('https_rewrite'):
# loade https rules # loade https rules
from searx.https_rewrite import load_https_rules
load_https_rules(https_rewrite_path) load_https_rules(https_rewrite_path)
logger.info('Initialisation done')