izihawa-loglib 1.1.4__tar.gz → 1.1.6__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.
- {izihawa_loglib-1.1.4 → izihawa_loglib-1.1.6}/PKG-INFO +1 -1
- {izihawa_loglib-1.1.4 → izihawa_loglib-1.1.6}/izihawa_loglib/__init__.py +1 -1
- {izihawa_loglib-1.1.4 → izihawa_loglib-1.1.6}/izihawa_loglib/formatters.py +3 -1
- {izihawa_loglib-1.1.4 → izihawa_loglib-1.1.6}/izihawa_loglib/request_context.py +4 -6
- {izihawa_loglib-1.1.4 → izihawa_loglib-1.1.6}/pyproject.toml +1 -1
- {izihawa_loglib-1.1.4 → izihawa_loglib-1.1.6}/README.md +0 -0
- {izihawa_loglib-1.1.4 → izihawa_loglib-1.1.6}/izihawa_loglib/handlers.py +0 -0
@@ -27,7 +27,7 @@ def error_log(e, level=logging.ERROR, **fields):
|
|
27
27
|
e.update(fields)
|
28
28
|
elif fields:
|
29
29
|
e = {"error": repr(e), **fields}
|
30
|
-
logging.getLogger("error").log(msg=str(e), level=level)
|
30
|
+
logging.getLogger("error").log(msg=str(e), level=level, exc_info=True)
|
31
31
|
|
32
32
|
|
33
33
|
__all__ = [
|
@@ -90,9 +90,11 @@ class DefaultFormatter(BaseFormatter):
|
|
90
90
|
class TracebackFormatter(DefaultFormatter):
|
91
91
|
def format(self, record):
|
92
92
|
log_record = self._prepare(record)
|
93
|
-
value = pprint.pformat(log_record, indent=2)
|
94
93
|
if traceback.sys.exc_info()[0] is not None:
|
94
|
+
value = pprint.pformat(log_record, indent=2)
|
95
95
|
value += "\n" + traceback.format_exc()
|
96
|
+
else:
|
97
|
+
value = json.dumps(log_record).decode()
|
96
98
|
return value
|
97
99
|
|
98
100
|
|
@@ -7,12 +7,10 @@ from izihawa_utils.random import generate_request_id
|
|
7
7
|
class RequestContext:
|
8
8
|
request_id_length: int = 12
|
9
9
|
|
10
|
-
def __init__(
|
11
|
-
self
|
12
|
-
|
13
|
-
|
14
|
-
):
|
15
|
-
self.request_id = request_id or RequestContext.generate_request_id(self.request_id_length)
|
10
|
+
def __init__(self, request_id: str = None, **kwargs):
|
11
|
+
self.request_id = request_id or RequestContext.generate_request_id(
|
12
|
+
self.request_id_length
|
13
|
+
)
|
16
14
|
self.default_fields = {
|
17
15
|
"request_id": self.request_id,
|
18
16
|
**kwargs,
|
File without changes
|
File without changes
|