izihawa-loglib 1.1.8__tar.gz → 1.1.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.
- {izihawa_loglib-1.1.8 → izihawa_loglib-1.1.9}/PKG-INFO +1 -1
- {izihawa_loglib-1.1.8 → izihawa_loglib-1.1.9}/izihawa_loglib/request_context.py +15 -10
- {izihawa_loglib-1.1.8 → izihawa_loglib-1.1.9}/pyproject.toml +1 -1
- {izihawa_loglib-1.1.8 → izihawa_loglib-1.1.9}/README.md +0 -0
- {izihawa_loglib-1.1.8 → izihawa_loglib-1.1.9}/izihawa_loglib/__init__.py +0 -0
- {izihawa_loglib-1.1.8 → izihawa_loglib-1.1.9}/izihawa_loglib/formatters.py +0 -0
- {izihawa_loglib-1.1.8 → izihawa_loglib-1.1.9}/izihawa_loglib/handlers.py +0 -0
@@ -1,4 +1,5 @@
|
|
1
1
|
import logging
|
2
|
+
from typing import Any
|
2
3
|
|
3
4
|
from izihawa_loglib import error_log
|
4
5
|
from izihawa_utils.random import generate_request_id
|
@@ -7,16 +8,20 @@ from izihawa_utils.random import generate_request_id
|
|
7
8
|
class RequestContext:
|
8
9
|
request_id_length: int = 12
|
9
10
|
|
10
|
-
def __init__(
|
11
|
-
self
|
12
|
-
|
13
|
-
|
14
|
-
self.
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
11
|
+
def __init__(
|
12
|
+
self, **kwargs: dict[str, Any],
|
13
|
+
):
|
14
|
+
self.default_fields = kwargs
|
15
|
+
if "request_id" not in self.default_fields:
|
16
|
+
self.default_fields["request_id"] = RequestContext.generate_request_id(
|
17
|
+
self.request_id_length
|
18
|
+
)
|
19
|
+
|
20
|
+
def __getattr__(self, name: str) -> Any:
|
21
|
+
return self.default_fields[name]
|
22
|
+
|
23
|
+
def __setattr__(self, key: str, value: Any):
|
24
|
+
self.default_fields[key] = value
|
20
25
|
|
21
26
|
@staticmethod
|
22
27
|
def generate_request_id(length):
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|