python3-commons 0.16.3__py3-none-any.whl → 0.16.4__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.
@@ -1,14 +1,11 @@
1
1
  import logging
2
2
  import traceback
3
- from contextvars import ContextVar
4
3
  from datetime import UTC, datetime, date
5
4
  from decimal import Decimal
6
- from typing import Any, Final, Callable
5
+ from typing import Any, Final
7
6
 
8
7
  import msgspec
9
8
 
10
- correlation_id: ContextVar[str | None] = ContextVar('correlation_id', default=None)
11
-
12
9
  _DEFAULT_MAX_TB_CHARS: Final[int] = 8_000
13
10
  _STD_LOG_FIELDS: Final[frozenset[str]] = frozenset(
14
11
  {
@@ -53,18 +50,16 @@ def _normalize(v: Any) -> Any:
53
50
 
54
51
 
55
52
  class JSONFormatter(logging.Formatter):
56
- __slots__ = ('_get_correlation_id', '_max_tb_chars', '_encoder')
53
+ __slots__ = ('_max_tb_chars', '_encoder')
57
54
 
58
55
  def __init__(
59
56
  self,
60
57
  *,
61
- get_correlation_id: Callable[[], str | None] = lambda: correlation_id.get(),
62
58
  max_exc_tb_chars: int = _DEFAULT_MAX_TB_CHARS,
63
59
  **kwargs: Any,
64
60
  ) -> None:
65
61
  super().__init__(**kwargs)
66
62
 
67
- self._get_correlation_id = get_correlation_id
68
63
  self._max_tb_chars = max_exc_tb_chars
69
64
  self._encoder = msgspec.json.Encoder()
70
65
 
@@ -82,9 +77,6 @@ class JSONFormatter(logging.Formatter):
82
77
  'timestamp': timestamp,
83
78
  }
84
79
 
85
- if (corr_id := self._get_correlation_id()) is not None:
86
- log['correlation_id'] = corr_id
87
-
88
80
  if (exc_info := record.exc_info) and exc_info[0] is not None:
89
81
  exc_type, exc_value, exc_tb = exc_info
90
82
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python3-commons
3
- Version: 0.16.3
3
+ Version: 0.16.4
4
4
  Summary: Re-usable Python3 code
5
5
  Author-email: Oleg Korsak <kamikaze.is.waiting.you@gmail.com>
6
6
  License-Expression: GPL-3.0
@@ -20,15 +20,15 @@ python3_commons/db/models/rbac.py,sha256=ARRQ1tn_GThxiBiIs_6IKkGnIIv37SmVgSi90cb
20
20
  python3_commons/db/models/users.py,sha256=zNN3bNWl3cVE6dJtTPzmPSo_5d1SsBZwwkvIs-WzUBA,644
21
21
  python3_commons/log/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
22
  python3_commons/log/filters.py,sha256=fuyjXZAUm-i2MNrxvFYag8F8Rr27x8W8MdV3ke6miSs,175
23
- python3_commons/log/formatters.py,sha256=mSDnEXIrokcfNhUbUA4GB53zDDCsEs0cwvYqKeg4syY,3128
23
+ python3_commons/log/formatters.py,sha256=Jq01Z8VEM0VMU_gE5sZc2J-ZoMUH_emO-v6bte6g7ws,2723
24
24
  python3_commons/serializers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
25
25
  python3_commons/serializers/common.py,sha256=VkA7C6wODvHk0QBXVX_x2JieDstihx3U__UFbTYf654,120
26
26
  python3_commons/serializers/json.py,sha256=UPkC3ps13x2C_NxwVV-K7Ewp4VjkVHSSUkJVw5k7Wiw,712
27
27
  python3_commons/serializers/msgpack.py,sha256=zESFBX34GsZ8rDu6Zk5V6CLT6P0mPilU0r04Ka6TblI,1474
28
28
  python3_commons/serializers/msgspec.py,sha256=upy5CBmK66-8hYnK5bAM_sZvZY5CAqZmzCw9GIF346I,2988
29
- python3_commons-0.16.3.dist-info/licenses/AUTHORS.rst,sha256=3R9JnfjfjH5RoPWOeqKFJgxVShSSfzQPIrEr1nxIo9Q,90
30
- python3_commons-0.16.3.dist-info/licenses/LICENSE,sha256=xxILuojHm4fKQOrMHPSslbyy6WuKAN2RiG74HbrYfzM,34575
31
- python3_commons-0.16.3.dist-info/METADATA,sha256=9PYgnQw8bHihX4XvtmnX9WpQlSrTCB7Uh0S5bTO06ik,1021
32
- python3_commons-0.16.3.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
33
- python3_commons-0.16.3.dist-info/top_level.txt,sha256=lJI6sCBf68eUHzupCnn2dzG10lH3jJKTWM_hrN1cQ7M,16
34
- python3_commons-0.16.3.dist-info/RECORD,,
29
+ python3_commons-0.16.4.dist-info/licenses/AUTHORS.rst,sha256=3R9JnfjfjH5RoPWOeqKFJgxVShSSfzQPIrEr1nxIo9Q,90
30
+ python3_commons-0.16.4.dist-info/licenses/LICENSE,sha256=xxILuojHm4fKQOrMHPSslbyy6WuKAN2RiG74HbrYfzM,34575
31
+ python3_commons-0.16.4.dist-info/METADATA,sha256=ZI4Gqt7VL4Y8BeCjcmzwUdfERtuFGBZu1G_GSDpHRtU,1021
32
+ python3_commons-0.16.4.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
33
+ python3_commons-0.16.4.dist-info/top_level.txt,sha256=lJI6sCBf68eUHzupCnn2dzG10lH3jJKTWM_hrN1cQ7M,16
34
+ python3_commons-0.16.4.dist-info/RECORD,,