fluidattacks-core 4.2.0__py3-none-any.whl → 4.2.1__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,3 +1,4 @@
1
+ import copy
1
2
  import logging
2
3
  import sys
3
4
  from logging.handlers import HTTPHandler, QueueHandler, QueueListener
@@ -10,6 +11,22 @@ from fluidattacks_core.logging.filters import NoProductionFilter, ProductionOnly
10
11
  from fluidattacks_core.logging.formatters import ColorfulFormatter, CustomJsonFormatter
11
12
 
12
13
 
14
+ class CustomQueueHandler(QueueHandler):
15
+ """Class to fix QueueHandler missing exc_info field."""
16
+
17
+ def prepare(self, record: logging.LogRecord) -> logging.LogRecord:
18
+ original_exc_info = record.exc_info
19
+
20
+ # Avoid duplicate exc_text in the log message
21
+ no_exc_record = copy.copy(record)
22
+ no_exc_record.exc_info = None
23
+ prepared = super().prepare(no_exc_record)
24
+
25
+ prepared.exc_info = original_exc_info
26
+
27
+ return prepared
28
+
29
+
13
30
  class DebuggingHandler(logging.StreamHandler[TextIO]):
14
31
  """Logging handler for console environments implemented with `QueueHandler`.
15
32
 
@@ -38,7 +55,7 @@ class ProductionSyncHandler(logging.StreamHandler[TextIO]):
38
55
  self.setFormatter(CustomJsonFormatter())
39
56
 
40
57
 
41
- class ProductionAsyncHandler(QueueHandler):
58
+ class ProductionAsyncHandler(CustomQueueHandler):
42
59
  """Logging handler for production environments implemented with `QueueHandler`.
43
60
 
44
61
  Includes:
@@ -96,7 +113,7 @@ class DatadogLogsHandler(HTTPHandler):
96
113
  self.handleError(record)
97
114
 
98
115
 
99
- class TelemetryAsyncHandler(QueueHandler):
116
+ class TelemetryAsyncHandler(CustomQueueHandler):
100
117
  """Logging handler for sending logs to telemetry services asynchronously."""
101
118
 
102
119
  def __init__(self, service: str, source: str, dd_client_token: str) -> None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fluidattacks-core
3
- Version: 4.2.0
3
+ Version: 4.2.1
4
4
  Summary: Fluid Attacks Core Library
5
5
  Author-email: Development <development@fluidattacks.com>
6
6
  License: MPL-2.0
@@ -34,7 +34,7 @@ fluidattacks_core/http/validations.py,sha256=h10Hr906KJqda1rJJb8eOqk1Xyyz81lAJ1g
34
34
  fluidattacks_core/logging/__init__.py,sha256=y6D12LrvrsMwaveQn5C4Em3RyeS6mP6E9fRpq7gqS4o,1546
35
35
  fluidattacks_core/logging/filters.py,sha256=v03EWIbCGLKc6sdSQnO7ealxMdPzcJhd20rGr1PBZrE,388
36
36
  fluidattacks_core/logging/formatters.py,sha256=SCA4k9XvHJknmkTv63uiCBU31VrWOsgA7llEXYYj1uQ,6063
37
- fluidattacks_core/logging/handlers.py,sha256=MgUk0ekqq4G_NkbaYu4HQaPIrbWYanTllbF8ydqJBtE,4159
37
+ fluidattacks_core/logging/handlers.py,sha256=7fjCG0AqwlF0PRmH6MwkYRO1qdVoRjyYAAwML3A5lXY,4658
38
38
  fluidattacks_core/logging/presets.py,sha256=KU6d6PI61kklJ_o7NgAzU1DahEPM0KwwjTYHo2naHv8,939
39
39
  fluidattacks_core/logging/utils.py,sha256=jbAcwr0L6iPsId3dYEp-vAbtFex2UUU2l2iIk1F60BE,1115
40
40
  fluidattacks_core/logging/sources/__init__.py,sha256=lRd6zhhoRuinh27MtQv5j8nzZfk53e4hzz882_AGXic,4891
@@ -46,7 +46,7 @@ fluidattacks_core/semver/match_versions.py,sha256=3L3C0TIVH0AtDpISvk5HHBXFSbJh5V
46
46
  fluidattacks_core/serializers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
47
47
  fluidattacks_core/serializers/snippet.py,sha256=e520pZHC-fsNuYVNY30A7TcSugvUlFL6xdr74j5aCDM,12780
48
48
  fluidattacks_core/serializers/syntax.py,sha256=DkRsdMyMNrL0pRfsOSVAx79K8F0AmjBk676_d_v7PjM,15908
49
- fluidattacks_core-4.2.0.dist-info/METADATA,sha256=trE_GFPAmsQ3mhqugj1Y37OsO6qA9ak7BPC5AaQQ7cg,3199
50
- fluidattacks_core-4.2.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
51
- fluidattacks_core-4.2.0.dist-info/top_level.txt,sha256=m49ZyZ2zPQmDBxkSpjb20wr-ZbGVXdOMFBZrDiP5Lb8,18
52
- fluidattacks_core-4.2.0.dist-info/RECORD,,
49
+ fluidattacks_core-4.2.1.dist-info/METADATA,sha256=0O-UKXy3eSmKQDGSpwrNHdrN2Ozet4W8fxoXDP8Wkrc,3199
50
+ fluidattacks_core-4.2.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
51
+ fluidattacks_core-4.2.1.dist-info/top_level.txt,sha256=m49ZyZ2zPQmDBxkSpjb20wr-ZbGVXdOMFBZrDiP5Lb8,18
52
+ fluidattacks_core-4.2.1.dist-info/RECORD,,