izihawa-loglib 1.1.6__tar.gz → 1.1.8__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.6 → izihawa_loglib-1.1.8}/PKG-INFO +2 -2
- {izihawa_loglib-1.1.6 → izihawa_loglib-1.1.8}/izihawa_loglib/__init__.py +4 -2
- {izihawa_loglib-1.1.6 → izihawa_loglib-1.1.8}/izihawa_loglib/handlers.py +3 -3
- {izihawa_loglib-1.1.6 → izihawa_loglib-1.1.8}/izihawa_loglib/request_context.py +8 -6
- {izihawa_loglib-1.1.6 → izihawa_loglib-1.1.8}/pyproject.toml +2 -2
- {izihawa_loglib-1.1.6 → izihawa_loglib-1.1.8}/README.md +0 -0
- {izihawa_loglib-1.1.6 → izihawa_loglib-1.1.8}/izihawa_loglib/formatters.py +0 -0
@@ -1,10 +1,10 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: izihawa_loglib
|
3
|
-
Version: 1.1.
|
3
|
+
Version: 1.1.8
|
4
4
|
Summary: Izihawa log utilities
|
5
5
|
Author: Pasha Podolsky
|
6
6
|
Author-email: ppodolsky@me.com
|
7
|
-
Requires-Python: >=3.8.1,<
|
7
|
+
Requires-Python: >=3.8.1,<4.0.0
|
8
8
|
Classifier: Programming Language :: Python :: 3
|
9
9
|
Classifier: Programming Language :: Python :: 3.9
|
10
10
|
Classifier: Programming Language :: Python :: 3.10
|
@@ -10,8 +10,10 @@ from .handlers import QueueHandler
|
|
10
10
|
|
11
11
|
|
12
12
|
def configure_logging(
|
13
|
-
config: confuse.Configuration,
|
14
|
-
|
13
|
+
config: confuse.Configuration,
|
14
|
+
make_path: bool = False,
|
15
|
+
default_level: int = logging.INFO,
|
16
|
+
) -> None:
|
15
17
|
if config["application"]["debug"].get(bool) or "logging" not in config:
|
16
18
|
logging.basicConfig(stream=sys.stdout, level=default_level)
|
17
19
|
else:
|
@@ -16,7 +16,7 @@ class QueueHandler(logging.handlers.QueueHandler):
|
|
16
16
|
super().__init__(self._queue)
|
17
17
|
self._listener.start()
|
18
18
|
|
19
|
-
def stop(self):
|
19
|
+
def stop(self) -> None:
|
20
20
|
self._listener.stop()
|
21
21
|
|
22
22
|
def prepare(self, record):
|
@@ -31,8 +31,8 @@ class BaseFileHandler(logging.handlers.WatchedFileHandler):
|
|
31
31
|
|
32
32
|
|
33
33
|
class BaseBinaryFileHandler(BaseFileHandler):
|
34
|
-
def __init__(self, *args, **kwargs):
|
35
|
-
super().__init__(*args, **kwargs
|
34
|
+
def __init__(self, *args, mode="ab+", **kwargs) -> None:
|
35
|
+
super().__init__(*args, mode=mode, **kwargs)
|
36
36
|
|
37
37
|
def emit(self, record):
|
38
38
|
try:
|
@@ -7,12 +7,14 @@ from izihawa_utils.random import generate_request_id
|
|
7
7
|
class RequestContext:
|
8
8
|
request_id_length: int = 12
|
9
9
|
|
10
|
-
def __init__(self, request_id: str = None, **kwargs):
|
10
|
+
def __init__(self, request_id: str | None = None, client_id: str | None = None, **kwargs):
|
11
11
|
self.request_id = request_id or RequestContext.generate_request_id(
|
12
12
|
self.request_id_length
|
13
13
|
)
|
14
|
+
self.client_id = client_id
|
14
15
|
self.default_fields = {
|
15
16
|
"request_id": self.request_id,
|
17
|
+
"client_id": self.client_id,
|
16
18
|
**kwargs,
|
17
19
|
}
|
18
20
|
|
@@ -20,18 +22,18 @@ class RequestContext:
|
|
20
22
|
def generate_request_id(length):
|
21
23
|
return generate_request_id(length)
|
22
24
|
|
23
|
-
def add_default_fields(self, **fields):
|
25
|
+
def add_default_fields(self, **fields: dict) -> None:
|
24
26
|
self.default_fields.update(fields)
|
25
27
|
|
26
|
-
def statbox(self, **kwargs):
|
28
|
+
def statbox(self, **kwargs: dict) -> None:
|
27
29
|
logging.getLogger("statbox").info(msg={**self.default_fields, **kwargs})
|
28
30
|
|
29
|
-
def user_log(self, **kwargs):
|
31
|
+
def user_log(self, **kwargs: dict) -> None:
|
30
32
|
logging.getLogger("user").info(msg={**self.default_fields, **kwargs})
|
31
33
|
|
32
|
-
def debug_log(self, **kwargs):
|
34
|
+
def debug_log(self, **kwargs: dict) -> None:
|
33
35
|
logging.getLogger("debug").debug(msg={**self.default_fields, **kwargs})
|
34
36
|
|
35
|
-
def error_log(self, e, level=logging.ERROR, **fields):
|
37
|
+
def error_log(self, e, level=logging.ERROR, **fields) -> None:
|
36
38
|
all_fields = {**self.default_fields, **fields}
|
37
39
|
error_log(e, level=level, **all_fields)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "izihawa_loglib"
|
3
|
-
version = "1.1.
|
3
|
+
version = "1.1.8"
|
4
4
|
description = "Izihawa log utilities"
|
5
5
|
authors = ["Pasha Podolsky <ppodolsky@me.com>"]
|
6
6
|
readme = "README.md"
|
@@ -8,7 +8,7 @@ packages = [{include = "izihawa_loglib"}]
|
|
8
8
|
|
9
9
|
|
10
10
|
[tool.poetry.dependencies]
|
11
|
-
python = "^3.8.1
|
11
|
+
python = "^3.8.1"
|
12
12
|
confuse = "^2.0.1"
|
13
13
|
izihawa-types = "^0.1.4"
|
14
14
|
izihawa-utils = "^1.2.1"
|
File without changes
|
File without changes
|