summaryrefslogtreecommitdiff
path: root/searx/search.py
diff options
context:
space:
mode:
Diffstat (limited to 'searx/search.py')
-rw-r--r--searx/search.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/searx/search.py b/searx/search.py
index 1c8b22f93..427da3bab 100644
--- a/searx/search.py
+++ b/searx/search.py
@@ -29,21 +29,23 @@ from searx.engines import (
from searx.languages import language_codes
from searx.utils import gen_useragent
from searx.query import Query
+from searx import logger
+logger = logger.getChild('search')
+
number_of_searches = 0
def search_request_wrapper(fn, url, engine_name, **kwargs):
try:
return fn(url, **kwargs)
- except Exception, e:
+ except:
# increase errors stats
engines[engine_name].stats['errors'] += 1
# print engine name and specific error message
- print('[E] Error with engine "{0}":\n\t{1}'.format(
- engine_name, str(e)))
+ logger.exception('engine crash: {0}'.format(engine_name))
return
@@ -66,7 +68,7 @@ def threaded_requests(requests):
remaining_time = max(0.0, timeout_limit - (time() - search_start))
th.join(remaining_time)
if th.isAlive():
- print('engine timeout: {0}'.format(th._engine_name))
+ logger.warning('engine timeout: {0}'.format(th._engine_name))
# get default reqest parameter