summaryrefslogtreecommitdiff
path: root/searx/__init__.py
diff options
context:
space:
mode:
authorAdam Tauber <asciimoo@gmail.com>2015-01-09 04:01:31 +0100
committerAdam Tauber <asciimoo@gmail.com>2015-01-09 04:01:31 +0100
commit6cbd29f674c1a4c585ea4e6b208ab9d53a141ee7 (patch)
tree7aedb0ced4e332849d48e8d9bb9ebfcc43200400 /searx/__init__.py
parent3b672039aab207d0002eac9d7406f0c5b3239df0 (diff)
downloadsearxng-6cbd29f674c1a4c585ea4e6b208ab9d53a141ee7.tar.gz
searxng-6cbd29f674c1a4c585ea4e6b208ab9d53a141ee7.zip
[enh] logging added
Diffstat (limited to 'searx/__init__.py')
-rw-r--r--searx/__init__.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/searx/__init__.py b/searx/__init__.py
index 46685817a..110f46af8 100644
--- a/searx/__init__.py
+++ b/searx/__init__.py
@@ -15,9 +15,9 @@ along with searx. If not, see < http://www.gnu.org/licenses/ >.
(C) 2013- by Adam Tauber, <asciimoo@gmail.com>
'''
+import logging
from os import environ
from os.path import realpath, dirname, join, abspath
-from searx.https_rewrite import load_https_rules
try:
from yaml import load
except:
@@ -45,7 +45,17 @@ else:
with open(settings_path) as 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
if settings.get('server', {}).get('https_rewrite'):
# loade https rules
+ from searx.https_rewrite import load_https_rules
load_https_rules(https_rewrite_path)
+
+logger.info('Initialisation done')