t-bug-catcher 0.5.7__tar.gz → 0.5.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {t_bug_catcher-0.5.7 → t_bug_catcher-0.5.9}/PKG-INFO +1 -1
- {t_bug_catcher-0.5.7 → t_bug_catcher-0.5.9}/setup.cfg +1 -1
- {t_bug_catcher-0.5.7 → t_bug_catcher-0.5.9}/setup.py +1 -1
- {t_bug_catcher-0.5.7 → t_bug_catcher-0.5.9}/t_bug_catcher/__init__.py +1 -1
- {t_bug_catcher-0.5.7 → t_bug_catcher-0.5.9}/t_bug_catcher/bug_catcher.py +4 -2
- {t_bug_catcher-0.5.7 → t_bug_catcher-0.5.9}/t_bug_catcher/config.py +4 -10
- {t_bug_catcher-0.5.7 → t_bug_catcher-0.5.9}/t_bug_catcher/stack_saver.py +0 -4
- t_bug_catcher-0.5.9/t_bug_catcher/utils/logger.py +16 -0
- {t_bug_catcher-0.5.7 → t_bug_catcher-0.5.9}/t_bug_catcher.egg-info/PKG-INFO +1 -1
- t_bug_catcher-0.5.7/t_bug_catcher/utils/logger.py +0 -24
- {t_bug_catcher-0.5.7 → t_bug_catcher-0.5.9}/MANIFEST.in +0 -0
- {t_bug_catcher-0.5.7 → t_bug_catcher-0.5.9}/README.rst +0 -0
- {t_bug_catcher-0.5.7 → t_bug_catcher-0.5.9}/pyproject.toml +0 -0
- {t_bug_catcher-0.5.7 → t_bug_catcher-0.5.9}/requirements.txt +0 -0
- {t_bug_catcher-0.5.7 → t_bug_catcher-0.5.9}/t_bug_catcher/bug_snag.py +0 -0
- {t_bug_catcher-0.5.7 → t_bug_catcher-0.5.9}/t_bug_catcher/exceptions.py +0 -0
- {t_bug_catcher-0.5.7 → t_bug_catcher-0.5.9}/t_bug_catcher/jira.py +0 -0
- {t_bug_catcher-0.5.7 → t_bug_catcher-0.5.9}/t_bug_catcher/resources/whispers_config.yml +0 -0
- {t_bug_catcher-0.5.7 → t_bug_catcher-0.5.9}/t_bug_catcher/utils/__init__.py +0 -0
- {t_bug_catcher-0.5.7 → t_bug_catcher-0.5.9}/t_bug_catcher/utils/common.py +0 -0
- {t_bug_catcher-0.5.7 → t_bug_catcher-0.5.9}/t_bug_catcher/workitems.py +0 -0
- {t_bug_catcher-0.5.7 → t_bug_catcher-0.5.9}/t_bug_catcher.egg-info/SOURCES.txt +0 -0
- {t_bug_catcher-0.5.7 → t_bug_catcher-0.5.9}/t_bug_catcher.egg-info/dependency_links.txt +0 -0
- {t_bug_catcher-0.5.7 → t_bug_catcher-0.5.9}/t_bug_catcher.egg-info/not-zip-safe +0 -0
- {t_bug_catcher-0.5.7 → t_bug_catcher-0.5.9}/t_bug_catcher.egg-info/requires.txt +0 -0
- {t_bug_catcher-0.5.7 → t_bug_catcher-0.5.9}/t_bug_catcher.egg-info/top_level.txt +0 -0
- {t_bug_catcher-0.5.7 → t_bug_catcher-0.5.9}/tests/test_t_bug_catcher.py +0 -0
|
@@ -26,7 +26,7 @@ setup(
|
|
|
26
26
|
packages=find_packages(include=["t_bug_catcher", "t_bug_catcher.*"]),
|
|
27
27
|
test_suite="tests",
|
|
28
28
|
url="https://www.thoughtful.ai/",
|
|
29
|
-
version="0.5.
|
|
29
|
+
version="0.5.9",
|
|
30
30
|
zip_safe=False,
|
|
31
31
|
install_requires=install_requirements,
|
|
32
32
|
include_package_data=True,
|
|
@@ -190,7 +190,7 @@ class BugCatcher:
|
|
|
190
190
|
frames = get_frames(exception.__traceback__)
|
|
191
191
|
exc_info = f"{os.path.basename(frames[-1].filename)}:{frames[-1].name}:{frames[-1].lineno}"
|
|
192
192
|
exception.handled_error = exc_info
|
|
193
|
-
|
|
193
|
+
logger.info(f"Exception {exc_info} reported.")
|
|
194
194
|
self.__errors_count += 1
|
|
195
195
|
|
|
196
196
|
def report_error_to_jira(
|
|
@@ -292,7 +292,9 @@ class BugCatcher:
|
|
|
292
292
|
self.__jira.report_unhandled_error(exc_type, exc_value, exc_traceback, stack_trace)
|
|
293
293
|
if self.__configurator.is_bugsnag_configured:
|
|
294
294
|
self.__bug_snag.report_unhandled_error(exc_type, exc_value, exc_traceback)
|
|
295
|
-
|
|
295
|
+
frames = get_frames(exc_value.__traceback__)
|
|
296
|
+
exc_info = f"{os.path.basename(frames[-1].filename)}:{frames[-1].name}:{frames[-1].lineno}"
|
|
297
|
+
logger.info(f"Exception {exc_info} reported.")
|
|
296
298
|
self.__errors_count += 1
|
|
297
299
|
|
|
298
300
|
def __get_sys_hook_attribute(self, attribute: str = "bug_catcher_client"):
|
|
@@ -45,16 +45,10 @@ class Config:
|
|
|
45
45
|
else variables.get("environment", "local")
|
|
46
46
|
)
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
EMPOWER_URL = metadata.get("process", dict()).get("processRunUrl") or variables.get("processRunUrl")
|
|
53
|
-
else:
|
|
54
|
-
STAGE = "test"
|
|
55
|
-
ADMIN_CODE = ""
|
|
56
|
-
WORKER_NAME = ""
|
|
57
|
-
EMPOWER_URL = ""
|
|
48
|
+
STAGE = metadata.get("process", dict()).get("implementationStage", "")
|
|
49
|
+
ADMIN_CODE = metadata.get("process", dict()).get("adminCode", "")
|
|
50
|
+
WORKER_NAME = metadata.get("process", dict()).get("name", "")
|
|
51
|
+
EMPOWER_URL = metadata.get("process", dict()).get("processRunUrl") or variables.get("processRunUrl")
|
|
58
52
|
|
|
59
53
|
|
|
60
54
|
CONFIG = Config()
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import inspect
|
|
2
1
|
import json
|
|
3
2
|
import linecache
|
|
4
3
|
import re
|
|
@@ -32,14 +31,12 @@ class StackSaver:
|
|
|
32
31
|
dict: The serialized frame info.
|
|
33
32
|
"""
|
|
34
33
|
run_locals = convert_keys_to_primitives(frame_info["locals"]) if frame_info["locals"] else {}
|
|
35
|
-
run_args = convert_keys_to_primitives(frame_info["args"]) if frame_info["args"] else {}
|
|
36
34
|
serializable_frame_info = {
|
|
37
35
|
"filename": frame_info["filename"],
|
|
38
36
|
"function_name": frame_info["function_name"],
|
|
39
37
|
"line_number": frame_info["line_number"],
|
|
40
38
|
"line": frame_info["line"],
|
|
41
39
|
"locals": run_locals,
|
|
42
|
-
"args": run_args,
|
|
43
40
|
}
|
|
44
41
|
return serializable_frame_info
|
|
45
42
|
|
|
@@ -137,7 +134,6 @@ class StackSaver:
|
|
|
137
134
|
"line_number": frame.f_lineno,
|
|
138
135
|
"line": linecache.getline(frame.f_code.co_filename, frame.f_lineno).strip(),
|
|
139
136
|
"locals": self.filter_variables(frame.f_locals),
|
|
140
|
-
"args": self.filter_variables(inspect.getargvalues(frame)[3]),
|
|
141
137
|
}
|
|
142
138
|
stack_details_json.append(self.serialize_frame_info(frame_info))
|
|
143
139
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""Logger."""
|
|
2
|
+
import logging
|
|
3
|
+
import sys
|
|
4
|
+
|
|
5
|
+
log_format = logging.Formatter("[%(asctime)s] %(levelname)-8s %(name)-17s %(message)s")
|
|
6
|
+
log_level = logging.DEBUG
|
|
7
|
+
logger = logging.getLogger("t_bug_catcher")
|
|
8
|
+
if logger.hasHandlers():
|
|
9
|
+
logger.handlers = []
|
|
10
|
+
logger.setLevel(log_level)
|
|
11
|
+
logger.propagate = False
|
|
12
|
+
|
|
13
|
+
handler = logging.StreamHandler(sys.stdout)
|
|
14
|
+
handler.setLevel(log_level)
|
|
15
|
+
handler.setFormatter(log_format)
|
|
16
|
+
logger.addHandler(handler)
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"""Logger."""
|
|
2
|
-
import logging
|
|
3
|
-
|
|
4
|
-
try:
|
|
5
|
-
from libraries import logger
|
|
6
|
-
|
|
7
|
-
if not isinstance(logger, logging.Logger):
|
|
8
|
-
raise TypeError("Logger is not an instance of logging.Logger.")
|
|
9
|
-
except (ImportError, TypeError):
|
|
10
|
-
log_format = logging.Formatter(
|
|
11
|
-
r"%(asctime)s - %(levelname)-7s %(threadName)-12s [%(filename)s:%(lineno)s - %(funcName)s()] - %(message)s"
|
|
12
|
-
)
|
|
13
|
-
log_level = logging.DEBUG
|
|
14
|
-
|
|
15
|
-
logger = logging.getLogger("t_bug_catcher")
|
|
16
|
-
if logger.hasHandlers():
|
|
17
|
-
logger.handlers = []
|
|
18
|
-
logger.setLevel(log_level)
|
|
19
|
-
logger.propagate = False
|
|
20
|
-
|
|
21
|
-
handler = logging.StreamHandler()
|
|
22
|
-
handler.setLevel(log_level)
|
|
23
|
-
handler.setFormatter(log_format)
|
|
24
|
-
logger.addHandler(handler)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|