risclog.logging 2.2.2__tar.gz → 2.3.0__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.
Files changed (47) hide show
  1. {risclog.logging-2.2.2 → risclog_logging-2.3.0}/CHANGES.rst +14 -0
  2. {risclog.logging-2.2.2 → risclog_logging-2.3.0}/PKG-INFO +80 -9
  3. {risclog.logging-2.2.2 → risclog_logging-2.3.0}/README.rst +50 -0
  4. {risclog.logging-2.2.2 → risclog_logging-2.3.0}/pyproject.toml +1 -1
  5. {risclog.logging-2.2.2 → risclog_logging-2.3.0}/setup.py +3 -9
  6. risclog_logging-2.3.0/src/risclog/logging/decorators.py +601 -0
  7. {risclog.logging-2.2.2 → risclog_logging-2.3.0}/src/risclog/logging/log.py +0 -3
  8. {risclog.logging-2.2.2 → risclog_logging-2.3.0}/src/risclog/logging/tests/test_logger.py +94 -0
  9. {risclog.logging-2.2.2 → risclog_logging-2.3.0}/src/risclog.logging.egg-info/PKG-INFO +80 -9
  10. {risclog.logging-2.2.2 → risclog_logging-2.3.0}/src/risclog.logging.egg-info/SOURCES.txt +0 -1
  11. {risclog.logging-2.2.2 → risclog_logging-2.3.0}/src/risclog.logging.egg-info/requires.txt +1 -2
  12. risclog.logging-2.2.2/src/risclog/logging/decorators.py +0 -192
  13. risclog.logging-2.2.2/src/risclog.logging.egg-info/namespace_packages.txt +0 -1
  14. {risclog.logging-2.2.2 → risclog_logging-2.3.0}/.github/ISSUE_TEMPLATE.md +0 -0
  15. {risclog.logging-2.2.2 → risclog_logging-2.3.0}/.github/workflows/test.yml +0 -0
  16. {risclog.logging-2.2.2 → risclog_logging-2.3.0}/.gitignore +0 -0
  17. {risclog.logging-2.2.2 → risclog_logging-2.3.0}/AUTHORS.rst +0 -0
  18. {risclog.logging-2.2.2 → risclog_logging-2.3.0}/CONTRIBUTING.rst +0 -0
  19. {risclog.logging-2.2.2 → risclog_logging-2.3.0}/LICENSE +0 -0
  20. {risclog.logging-2.2.2 → risclog_logging-2.3.0}/MANIFEST.in +0 -0
  21. {risclog.logging-2.2.2 → risclog_logging-2.3.0}/Makefile +0 -0
  22. {risclog.logging-2.2.2 → risclog_logging-2.3.0}/docs/Makefile +0 -0
  23. {risclog.logging-2.2.2 → risclog_logging-2.3.0}/docs/authors.rst +0 -0
  24. {risclog.logging-2.2.2 → risclog_logging-2.3.0}/docs/conf.py +0 -0
  25. {risclog.logging-2.2.2 → risclog_logging-2.3.0}/docs/contributing.rst +0 -0
  26. {risclog.logging-2.2.2 → risclog_logging-2.3.0}/docs/history.rst +0 -0
  27. {risclog.logging-2.2.2 → risclog_logging-2.3.0}/docs/index.rst +0 -0
  28. {risclog.logging-2.2.2 → risclog_logging-2.3.0}/docs/installation.rst +0 -0
  29. {risclog.logging-2.2.2 → risclog_logging-2.3.0}/docs/make.bat +0 -0
  30. {risclog.logging-2.2.2 → risclog_logging-2.3.0}/docs/readme.rst +0 -0
  31. {risclog.logging-2.2.2 → risclog_logging-2.3.0}/docs/usage.rst +0 -0
  32. {risclog.logging-2.2.2 → risclog_logging-2.3.0}/mypy.ini +0 -0
  33. {risclog.logging-2.2.2 → risclog_logging-2.3.0}/scripts/all_in_one.py +0 -0
  34. {risclog.logging-2.2.2 → risclog_logging-2.3.0}/scripts/api.py +0 -0
  35. {risclog.logging-2.2.2 → risclog_logging-2.3.0}/scripts/simple_test.py +0 -0
  36. {risclog.logging-2.2.2 → risclog_logging-2.3.0}/scripts/test_logger.py +0 -0
  37. {risclog.logging-2.2.2 → risclog_logging-2.3.0}/setup.cfg +0 -0
  38. {risclog.logging-2.2.2 → risclog_logging-2.3.0}/src/risclog/__init__.py +0 -0
  39. {risclog.logging-2.2.2 → risclog_logging-2.3.0}/src/risclog/logging/__init__.py +0 -0
  40. {risclog.logging-2.2.2 → risclog_logging-2.3.0}/src/risclog/logging/conftest.py +0 -0
  41. {risclog.logging-2.2.2 → risclog_logging-2.3.0}/src/risclog/logging/py.typed +0 -0
  42. {risclog.logging-2.2.2 → risclog_logging-2.3.0}/src/risclog/logging/sender.py +0 -0
  43. {risclog.logging-2.2.2 → risclog_logging-2.3.0}/src/risclog/logging/tests/__init__.py +0 -0
  44. {risclog.logging-2.2.2 → risclog_logging-2.3.0}/src/risclog/logging/tests/test_sender.py +0 -0
  45. {risclog.logging-2.2.2 → risclog_logging-2.3.0}/src/risclog.logging.egg-info/dependency_links.txt +0 -0
  46. {risclog.logging-2.2.2 → risclog_logging-2.3.0}/src/risclog.logging.egg-info/not-zip-safe +0 -0
  47. {risclog.logging-2.2.2 → risclog_logging-2.3.0}/src/risclog.logging.egg-info/top_level.txt +0 -0
@@ -3,6 +3,20 @@ Change log for risclog.logging
3
3
  ==============================
4
4
 
5
5
 
6
+ 2.3.0 (2026-07-01)
7
+ ==================
8
+
9
+ - Sanitize ``log_decorator`` values by redacting secrets and truncating large
10
+ arguments, keyword arguments, return values and exception messages, including
11
+ S3-compatible credentials from environment variables.
12
+
13
+
14
+ 2.2.3 (2026-06-30)
15
+ ==================
16
+
17
+ - Reenable uvicorn logger.
18
+
19
+
6
20
  2.2.2 (2026-04-13)
7
21
  ==================
8
22
 
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: risclog.logging
3
- Version: 2.2.2
3
+ Version: 2.3.0
4
4
  Summary: A logger based on structlog
5
5
  Home-page: https://github.com/risclog-solution/risclog.logging
6
6
  Author: riscLOG Solution GmbH
@@ -12,13 +12,9 @@ Classifier: Intended Audience :: Developers
12
12
  Classifier: License :: OSI Approved :: MIT License
13
13
  Classifier: Natural Language :: German
14
14
  Classifier: Programming Language :: Python :: 3
15
- Classifier: Programming Language :: Python :: 3.8
16
- Classifier: Programming Language :: Python :: 3.9
17
- Classifier: Programming Language :: Python :: 3.10
18
- Classifier: Programming Language :: Python :: 3.11
19
15
  Classifier: Programming Language :: Python :: 3.12
20
16
  Classifier: Programming Language :: Python :: 3.13
21
- Requires-Python: >=3.8
17
+ Requires-Python: >=3.12
22
18
  License-File: LICENSE
23
19
  License-File: AUTHORS.rst
24
20
  Requires-Dist: structlog
@@ -29,18 +25,29 @@ Requires-Dist: Sphinx; extra == "docs"
29
25
  Provides-Extra: test
30
26
  Requires-Dist: pytest-cache; extra == "test"
31
27
  Requires-Dist: pytest-cov; extra == "test"
32
- Requires-Dist: pytest-flake8; extra == "test"
33
28
  Requires-Dist: pytest-rerunfailures; extra == "test"
34
29
  Requires-Dist: pytest-sugar; extra == "test"
35
30
  Requires-Dist: pytest; extra == "test"
36
31
  Requires-Dist: coverage; extra == "test"
37
- Requires-Dist: flake8<4; extra == "test"
32
+ Requires-Dist: ruff; extra == "test"
38
33
  Requires-Dist: mock; extra == "test"
39
34
  Requires-Dist: requests; extra == "test"
40
35
  Requires-Dist: httpx; extra == "test"
41
36
  Requires-Dist: pytest-asyncio; extra == "test"
42
37
  Requires-Dist: fastapi; extra == "test"
43
38
  Requires-Dist: uvicorn; extra == "test"
39
+ Dynamic: author
40
+ Dynamic: author-email
41
+ Dynamic: classifier
42
+ Dynamic: description
43
+ Dynamic: home-page
44
+ Dynamic: keywords
45
+ Dynamic: license
46
+ Dynamic: license-file
47
+ Dynamic: provides-extra
48
+ Dynamic: requires-dist
49
+ Dynamic: requires-python
50
+ Dynamic: summary
44
51
 
45
52
  ===================
46
53
  risclog.logging
@@ -212,6 +219,56 @@ The ``@log_decorator`` automatically logs function execution with comprehensive
212
219
  pass
213
220
  # Logs: [Decorator error in risky_operation] error='division by zero'
214
221
 
222
+ **Sanitizing decorator values:**
223
+
224
+ Decorator logs sanitize ``args``, ``kwargs``, ``result`` and exception strings
225
+ before they are written. Sensitive field names such as ``password``, ``token``,
226
+ ``api_key``, ``authorization``, ``cookie``, ``secret``, ``access_key`` and
227
+ ``secret_key`` are replaced with ``***REDACTED***``. Secret values from matching
228
+ environment variables such as ``S3_SECRET_KEY`` or ``MINIO_ACCESS_KEY`` are also
229
+ redacted when they appear inside log strings. Long strings, large containers,
230
+ binary data, private key blocks and recursive structures are shortened
231
+ automatically.
232
+
233
+ Example:
234
+
235
+ .. code-block:: python
236
+
237
+ import os
238
+ from risclog.logging import log_decorator
239
+
240
+ os.environ["S3_SECRET_KEY"] = "storage-secret-value"
241
+
242
+ @log_decorator
243
+ def upload_file(password: str, headers: dict) -> dict:
244
+ return {
245
+ "bucket": "documents",
246
+ "secret_key": "storage-secret-value",
247
+ "preview": "x" * 1000,
248
+ }
249
+
250
+ upload_file(
251
+ password="plain-password",
252
+ headers={"Authorization": "Bearer request-token"},
253
+ )
254
+
255
+ # Logs password='***REDACTED***'
256
+ # Logs headers={'Authorization': '***REDACTED***'}
257
+ # Logs result.secret_key='***REDACTED***'
258
+ # Logs result.preview='xxxxx...[truncated](chars=1000)'
259
+
260
+ The default limits can be adjusted via environment variables:
261
+
262
+ .. code-block:: bash
263
+
264
+ export LOG_DECORATOR_MAX_STRING_LENGTH=500
265
+ export LOG_DECORATOR_MAX_COLLECTION_ITEMS=20
266
+ export LOG_DECORATOR_MAX_DEPTH=4
267
+ export LOG_DECORATOR_MAX_EXCEPTION_LENGTH=8000
268
+ export LOG_DECORATOR_MIN_SECRET_VALUE_LENGTH=8
269
+ export LOG_DECORATOR_REDACT_KEYS="iban,customer_secret"
270
+ export LOG_DECORATOR_REDACT_ENV_VARS="CUSTOM_S3_SECRET"
271
+
215
272
  Using the Decorator in Classes
216
273
  ------------------------------
217
274
 
@@ -496,6 +553,20 @@ Change log for risclog.logging
496
553
  ==============================
497
554
 
498
555
 
556
+ 2.3.0 (2026-07-01)
557
+ ==================
558
+
559
+ - Sanitize ``log_decorator`` values by redacting secrets and truncating large
560
+ arguments, keyword arguments, return values and exception messages, including
561
+ S3-compatible credentials from environment variables.
562
+
563
+
564
+ 2.2.3 (2026-06-30)
565
+ ==================
566
+
567
+ - Reenable uvicorn logger.
568
+
569
+
499
570
  2.2.2 (2026-04-13)
500
571
  ==================
501
572
 
@@ -168,6 +168,56 @@ The ``@log_decorator`` automatically logs function execution with comprehensive
168
168
  pass
169
169
  # Logs: [Decorator error in risky_operation] error='division by zero'
170
170
 
171
+ **Sanitizing decorator values:**
172
+
173
+ Decorator logs sanitize ``args``, ``kwargs``, ``result`` and exception strings
174
+ before they are written. Sensitive field names such as ``password``, ``token``,
175
+ ``api_key``, ``authorization``, ``cookie``, ``secret``, ``access_key`` and
176
+ ``secret_key`` are replaced with ``***REDACTED***``. Secret values from matching
177
+ environment variables such as ``S3_SECRET_KEY`` or ``MINIO_ACCESS_KEY`` are also
178
+ redacted when they appear inside log strings. Long strings, large containers,
179
+ binary data, private key blocks and recursive structures are shortened
180
+ automatically.
181
+
182
+ Example:
183
+
184
+ .. code-block:: python
185
+
186
+ import os
187
+ from risclog.logging import log_decorator
188
+
189
+ os.environ["S3_SECRET_KEY"] = "storage-secret-value"
190
+
191
+ @log_decorator
192
+ def upload_file(password: str, headers: dict) -> dict:
193
+ return {
194
+ "bucket": "documents",
195
+ "secret_key": "storage-secret-value",
196
+ "preview": "x" * 1000,
197
+ }
198
+
199
+ upload_file(
200
+ password="plain-password",
201
+ headers={"Authorization": "Bearer request-token"},
202
+ )
203
+
204
+ # Logs password='***REDACTED***'
205
+ # Logs headers={'Authorization': '***REDACTED***'}
206
+ # Logs result.secret_key='***REDACTED***'
207
+ # Logs result.preview='xxxxx...[truncated](chars=1000)'
208
+
209
+ The default limits can be adjusted via environment variables:
210
+
211
+ .. code-block:: bash
212
+
213
+ export LOG_DECORATOR_MAX_STRING_LENGTH=500
214
+ export LOG_DECORATOR_MAX_COLLECTION_ITEMS=20
215
+ export LOG_DECORATOR_MAX_DEPTH=4
216
+ export LOG_DECORATOR_MAX_EXCEPTION_LENGTH=8000
217
+ export LOG_DECORATOR_MIN_SECRET_VALUE_LENGTH=8
218
+ export LOG_DECORATOR_REDACT_KEYS="iban,customer_secret"
219
+ export LOG_DECORATOR_REDACT_ENV_VARS="CUSTOM_S3_SECRET"
220
+
171
221
  Using the Decorator in Classes
172
222
  ------------------------------
173
223
 
@@ -37,7 +37,7 @@ exclude_lines = [
37
37
 
38
38
  [tool.black]
39
39
  line-length = 79
40
- target-version = ['py39']
40
+ target-version = ['py312']
41
41
  exclude = '''
42
42
  /(
43
43
  \.eggs
@@ -13,17 +13,13 @@ with open("CHANGES.rst") as history_file:
13
13
  setup(
14
14
  author="riscLOG Solution GmbH",
15
15
  author_email="info@risclog.de",
16
- python_requires=">=3.8",
16
+ python_requires=">=3.12",
17
17
  classifiers=[
18
18
  "Development Status :: 5 - Production/Stable",
19
19
  "Intended Audience :: Developers",
20
20
  "License :: OSI Approved :: MIT License",
21
21
  "Natural Language :: German",
22
22
  "Programming Language :: Python :: 3",
23
- "Programming Language :: Python :: 3.8",
24
- "Programming Language :: Python :: 3.9",
25
- "Programming Language :: Python :: 3.10",
26
- "Programming Language :: Python :: 3.11",
27
23
  "Programming Language :: Python :: 3.12",
28
24
  "Programming Language :: Python :: 3.13",
29
25
  ],
@@ -41,13 +37,12 @@ setup(
41
37
  "test": [
42
38
  "pytest-cache",
43
39
  "pytest-cov",
44
- "pytest-flake8",
45
40
  "pytest-rerunfailures",
46
41
  "pytest-sugar",
47
42
  "pytest",
48
43
  "coverage",
49
44
  # https://github.com/PyCQA/flake8/issues/1419#issuecomment-947243876
50
- "flake8<4",
45
+ "ruff",
51
46
  "mock",
52
47
  "requests",
53
48
  "httpx",
@@ -62,9 +57,8 @@ setup(
62
57
  keywords="risclog.logging",
63
58
  name="risclog.logging",
64
59
  packages=find_namespace_packages("src", include=["risclog.*"]),
65
- namespace_packages=["risclog"],
66
60
  package_dir={"": "src"},
67
61
  url="https://github.com/risclog-solution/risclog.logging",
68
- version="2.2.2",
62
+ version="2.3.0",
69
63
  zip_safe=False,
70
64
  )