izihawa-loglib 1.1.7__py3-none-any.whl → 1.1.8__py3-none-any.whl

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.
@@ -10,8 +10,10 @@ from .handlers import QueueHandler
10
10
 
11
11
 
12
12
  def configure_logging(
13
- config: confuse.Configuration, make_path: bool = False, default_level=logging.INFO
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, mode="ab+")
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
  Metadata-Version: 2.1
2
2
  Name: izihawa_loglib
3
- Version: 1.1.7
3
+ Version: 1.1.8
4
4
  Summary: Izihawa log utilities
5
5
  Author: Pasha Podolsky
6
6
  Author-email: ppodolsky@me.com
@@ -0,0 +1,7 @@
1
+ izihawa_loglib/__init__.py,sha256=E6ab53TTvjIwCOv8Wl8SbNyaPjXkOlim2fryehPgiEA,1005
2
+ izihawa_loglib/formatters.py,sha256=0V4cP50z-TimN-WmExqo7SEt8qFapCoW3h6BmtC_lCw,2886
3
+ izihawa_loglib/handlers.py,sha256=GU7SLTgia1pgY9ufvUQSsMMEweaAGe6B7ibKn2wLb1I,1122
4
+ izihawa_loglib/request_context.py,sha256=qV2PfKclsu1KTsio97rDCi_vacoc-AT-eS6yuvSIv6Q,1320
5
+ izihawa_loglib-1.1.8.dist-info/METADATA,sha256=Gxwrmq-ehyChroe5CafpLTTdz-X11CR-U69TnE9OrP4,657
6
+ izihawa_loglib-1.1.8.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
7
+ izihawa_loglib-1.1.8.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- izihawa_loglib/__init__.py,sha256=WByRneiSW-mxN_xFFSJjoBXiMmpCJaHR-yyrSRlqUiM,981
2
- izihawa_loglib/formatters.py,sha256=0V4cP50z-TimN-WmExqo7SEt8qFapCoW3h6BmtC_lCw,2886
3
- izihawa_loglib/handlers.py,sha256=UMBb7VSFvo4QUD0aueyzmh2ryq5tl8U4iKB9IIbax-0,1095
4
- izihawa_loglib/request_context.py,sha256=HMFD149Wpv2rw23NpEIRie_Dts86S3_u_swnEYXY4Qs,1143
5
- izihawa_loglib-1.1.7.dist-info/METADATA,sha256=0lO6y4pOzFa1DyglSQum7wXRKZ-fQTCn9lH1UN7Hmp0,657
6
- izihawa_loglib-1.1.7.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
7
- izihawa_loglib-1.1.7.dist-info/RECORD,,