diff options
author | Alexandre Flament <alex@al-f.net> | 2021-04-27 10:42:00 +0200 |
---|---|---|
committer | Alexandre Flament <alex@al-f.net> | 2021-04-27 10:42:00 +0200 |
commit | b8f5adf500d6da349974626597055f2c4df16160 (patch) | |
tree | 22c181c9d609436192e75d286d6edb94905df35b /searx/metrics | |
parent | 9b482e8fccfc5e5504e4c8abdb60ce5c11678018 (diff) | |
download | searxng-b8f5adf500d6da349974626597055f2c4df16160.tar.gz searxng-b8f5adf500d6da349974626597055f2c4df16160.zip |
[mod] searx.metrics.error_recorder: store relative file name instead of the full absolute file name.
Diffstat (limited to 'searx/metrics')
-rw-r--r-- | searx/metrics/error_recorder.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/searx/metrics/error_recorder.py b/searx/metrics/error_recorder.py index 2bf25fb0d..c5de008cc 100644 --- a/searx/metrics/error_recorder.py +++ b/searx/metrics/error_recorder.py @@ -5,7 +5,7 @@ from urllib.parse import urlparse from httpx import HTTPError, HTTPStatusError from searx.exceptions import (SearxXPathSyntaxException, SearxEngineXPathException, SearxEngineAPIException, SearxEngineAccessDeniedException) -from searx import logger +from searx import logger, searx_parent_dir errors_per_engines = {} @@ -117,6 +117,8 @@ def get_exception_classname(exc: Exception) -> str: def get_error_context(framerecords, exception_classname, log_message, log_parameters, secondary) -> ErrorContext: searx_frame = get_trace(framerecords) filename = searx_frame.filename + if filename.startswith(searx_parent_dir): + filename = filename[len(searx_parent_dir) + 1:] function = searx_frame.function line_no = searx_frame.lineno code = searx_frame.code_context[0].strip() |