|
@@ -22,6 +22,10 @@ from imp import load_source
|
22
|
22
|
from flask.ext.babel import gettext
|
23
|
23
|
from operator import itemgetter
|
24
|
24
|
from searx import settings
|
|
25
|
+from searx import logger
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+logger = logger.getChild('engines')
|
25
|
29
|
|
26
|
30
|
engine_dir = dirname(realpath(__file__))
|
27
|
31
|
|
|
@@ -81,7 +85,7 @@ def load_engine(engine_data):
|
81
|
85
|
if engine_attr.startswith('_'):
|
82
|
86
|
continue
|
83
|
87
|
if getattr(engine, engine_attr) is None:
|
84
|
|
- print('[E] Engine config error: Missing attribute "{0}.{1}"'
|
|
88
|
+ logger.error('Missing engine config attribute: "{0}.{1}"'
|
85
|
89
|
.format(engine.name, engine_attr))
|
86
|
90
|
sys.exit(1)
|
87
|
91
|
|
|
@@ -100,9 +104,8 @@ def load_engine(engine_data):
|
100
|
104
|
categories['general'].append(engine)
|
101
|
105
|
|
102
|
106
|
if engine.shortcut:
|
103
|
|
- # TODO check duplications
|
104
|
107
|
if engine.shortcut in engine_shortcuts:
|
105
|
|
- print('[E] Engine config error: ambigious shortcut: {0}'
|
|
108
|
+ logger.error('Engine config error: ambigious shortcut: {0}'
|
106
|
109
|
.format(engine.shortcut))
|
107
|
110
|
sys.exit(1)
|
108
|
111
|
engine_shortcuts[engine.shortcut] = engine.name
|
|
@@ -199,7 +202,7 @@ def get_engines_stats():
|
199
|
202
|
|
200
|
203
|
|
201
|
204
|
if 'engines' not in settings or not settings['engines']:
|
202
|
|
- print '[E] Error no engines found. Edit your settings.yml'
|
|
205
|
+ logger.error('No engines found. Edit your settings.yml')
|
203
|
206
|
exit(2)
|
204
|
207
|
|
205
|
208
|
for engine_data in settings['engines']:
|