mirror of
https://github.com/searxng/searxng
synced 2024-01-01 19:24:07 +01:00
Inject log_level into error_recorder
format
This commit is contained in:
parent
9f7244d6f1
commit
118a748fba
3 changed files with 37 additions and 11 deletions
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
"""
|
||||
|
||||
import logging
|
||||
from logging import Logger
|
||||
import threading
|
||||
from abc import abstractmethod, ABC
|
||||
|
|
@ -96,10 +97,11 @@ class EngineProcessor(ABC):
|
|||
result_container.add_unresponsive_engine(self.engine_name, error_message)
|
||||
# metrics
|
||||
counter_inc('engine', self.engine_name, 'search', 'count', 'error')
|
||||
log_level = logging.WARN if self.engine_exc_info else logging.NOTSET
|
||||
if isinstance(exception_or_message, BaseException):
|
||||
count_exception(self.engine_name, exception_or_message)
|
||||
count_exception(self.engine_name, exception_or_message, log_level=log_level)
|
||||
else:
|
||||
count_error(self.engine_name, exception_or_message)
|
||||
count_error(self.engine_name, exception_or_message, log_level=log_level)
|
||||
# suspend the engine ?
|
||||
if suspend:
|
||||
suspended_time = None
|
||||
|
|
|
|||
|
|
@ -126,6 +126,7 @@ class OnlineProcessor(EngineProcessor):
|
|||
self.engine_name,
|
||||
'{} redirects, maximum: {}'.format(len(response.history), soft_max_redirects),
|
||||
(status_code, reason, hostname),
|
||||
self.engine_exc_info,
|
||||
secondary=True,
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue