logxide 0.2.2__tar.gz → 0.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 (156) hide show
  1. {logxide-0.2.2 → logxide-0.3.0}/.github/workflows/benchmark.yml +1 -1
  2. {logxide-0.2.2 → logxide-0.3.0}/.github/workflows/publish.yml +4 -6
  3. {logxide-0.2.2 → logxide-0.3.0}/.pre-commit-config.yaml +1 -1
  4. {logxide-0.2.2 → logxide-0.3.0}/CHANGELOG.md +27 -1
  5. {logxide-0.2.2 → logxide-0.3.0}/CONTRIBUTING.md +6 -6
  6. {logxide-0.2.2 → logxide-0.3.0}/Cargo.lock +1 -1
  7. {logxide-0.2.2 → logxide-0.3.0}/Cargo.toml +1 -1
  8. {logxide-0.2.2 → logxide-0.3.0}/PKG-INFO +15 -8
  9. {logxide-0.2.2 → logxide-0.3.0}/README.md +13 -6
  10. logxide-0.3.0/SECURITY.md +257 -0
  11. {logxide-0.2.2 → logxide-0.3.0}/benchmark/_bench_common.py +11 -1
  12. {logxide-0.2.2 → logxide-0.3.0}/benchmark/basic_handlers_benchmark.py +104 -8
  13. {logxide-0.2.2 → logxide-0.3.0}/benchmark/compare_loggers.py +59 -9
  14. {logxide-0.2.2 → logxide-0.3.0}/benchmark/gil_benchmark.py +40 -8
  15. {logxide-0.2.2 → logxide-0.3.0}/benchmark/perf_micro.py +27 -2
  16. {logxide-0.2.2 → logxide-0.3.0}/benchmark/perf_vs_stdlib.py +48 -10
  17. {logxide-0.2.2 → logxide-0.3.0}/benchmark/real_handlers_comparison.py +61 -9
  18. {logxide-0.2.2 → logxide-0.3.0}/docker-compose.yml +4 -4
  19. {logxide-0.2.2 → logxide-0.3.0}/docs/architecture.md +9 -12
  20. {logxide-0.2.2 → logxide-0.3.0}/docs/benchmarks.md +7 -4
  21. {logxide-0.2.2 → logxide-0.3.0}/docs/blog-preview/part1.md +1 -1
  22. {logxide-0.2.2 → logxide-0.3.0}/docs/blog-preview/part2.md +4 -2
  23. {logxide-0.2.2 → logxide-0.3.0}/docs/comparison-picologging.md +7 -4
  24. {logxide-0.2.2 → logxide-0.3.0}/docs/comparison-stdlib.md +2 -2
  25. {logxide-0.2.2 → logxide-0.3.0}/docs/comparison-structlog.md +2 -2
  26. {logxide-0.2.2 → logxide-0.3.0}/docs/comparison.md +3 -3
  27. {logxide-0.2.2 → logxide-0.3.0}/docs/compatibility.md +22 -9
  28. {logxide-0.2.2 → logxide-0.3.0}/docs/development.md +10 -9
  29. {logxide-0.2.2 → logxide-0.3.0}/docs/index.md +1 -1
  30. {logxide-0.2.2 → logxide-0.3.0}/docs/installation.md +8 -10
  31. {logxide-0.2.2 → logxide-0.3.0}/docs/integrations/fastapi.md +6 -2
  32. {logxide-0.2.2 → logxide-0.3.0}/docs/integrations/sentry.md +37 -17
  33. {logxide-0.2.2 → logxide-0.3.0}/docs/reference.md +28 -34
  34. {logxide-0.2.2 → logxide-0.3.0}/docs/testing.md +12 -1
  35. {logxide-0.2.2 → logxide-0.3.0}/docs/third-party-compatibility.md +7 -9
  36. {logxide-0.2.2 → logxide-0.3.0}/docs/usage.md +20 -7
  37. {logxide-0.2.2 → logxide-0.3.0}/examples/django_integration.py +3 -1
  38. {logxide-0.2.2 → logxide-0.3.0}/examples/flask_integration.py +2 -1
  39. {logxide-0.2.2 → logxide-0.3.0}/logxide/__init__.py +3 -1
  40. {logxide-0.2.2 → logxide-0.3.0}/logxide/__init__.pyi +11 -47
  41. {logxide-0.2.2 → logxide-0.3.0}/logxide/compat_functions.py +7 -3
  42. {logxide-0.2.2 → logxide-0.3.0}/logxide/compat_handlers.py +19 -94
  43. {logxide-0.2.2 → logxide-0.3.0}/logxide/config.py +2 -0
  44. {logxide-0.2.2 → logxide-0.3.0}/logxide/fast_logger_wrapper.py +1 -3
  45. {logxide-0.2.2 → logxide-0.3.0}/logxide/handlers.py +260 -53
  46. logxide-0.3.0/logxide/interceptor.py +19 -0
  47. {logxide-0.2.2 → logxide-0.3.0}/logxide/logger_wrapper.py +6 -9
  48. {logxide-0.2.2 → logxide-0.3.0}/logxide/module_system.py +166 -124
  49. {logxide-0.2.2 → logxide-0.3.0}/logxide/testing.py +2 -6
  50. {logxide-0.2.2 → logxide-0.3.0}/pyproject.toml +2 -6
  51. {logxide-0.2.2 → logxide-0.3.0}/pyrightconfig.json +1 -4
  52. {logxide-0.2.2 → logxide-0.3.0}/src/core.rs +56 -49
  53. {logxide-0.2.2 → logxide-0.3.0}/src/fast_logger.rs +38 -33
  54. {logxide-0.2.2 → logxide-0.3.0}/src/formatter.rs +28 -19
  55. {logxide-0.2.2 → logxide-0.3.0}/src/globals.rs +33 -9
  56. {logxide-0.2.2 → logxide-0.3.0}/src/handler.rs +301 -229
  57. {logxide-0.2.2 → logxide-0.3.0}/src/lib.rs +12 -0
  58. {logxide-0.2.2 → logxide-0.3.0}/src/py_handlers.rs +40 -35
  59. {logxide-0.2.2 → logxide-0.3.0}/src/py_logger.rs +157 -66
  60. {logxide-0.2.2 → logxide-0.3.0}/tests/conftest.py +107 -126
  61. {logxide-0.2.2 → logxide-0.3.0}/tests/test_doc_codeblocks.py +10 -4
  62. logxide-0.3.0/tests/test_examples.py +194 -0
  63. {logxide-0.2.2 → logxide-0.3.0}/tests/test_gil_scaling.py +6 -15
  64. logxide-0.3.0/tests/test_http_auth.py +27 -0
  65. logxide-0.3.0/tests/test_http_handler_features.py +143 -0
  66. logxide-0.3.0/tests/test_integration_examples.py +86 -0
  67. {logxide-0.2.2 → logxide-0.3.0}/tests/test_interceptor.py +20 -0
  68. {logxide-0.2.2 → logxide-0.3.0}/tests/test_native_fastpath.py +4 -7
  69. {logxide-0.2.2 → logxide-0.3.0}/tests/test_optimizations.py +22 -5
  70. logxide-0.3.0/tests/test_overflow_flush.py +334 -0
  71. logxide-0.3.0/tests/test_review_benchmarks.py +787 -0
  72. logxide-0.3.0/tests/test_review_doc_collection.py +19 -0
  73. logxide-0.3.0/tests/test_review_docker_benchmark.py +41 -0
  74. logxide-0.3.0/tests/test_review_integration_docs.py +182 -0
  75. logxide-0.3.0/tests/test_review_native_errors.py +401 -0
  76. logxide-0.3.0/tests/test_review_package_tooling.py +47 -0
  77. logxide-0.3.0/tests/test_review_py_adapters.py +490 -0
  78. logxide-0.3.0/tests/test_review_release_ci.py +84 -0
  79. logxide-0.3.0/tests/test_review_routing_lifecycle.py +494 -0
  80. logxide-0.3.0/tests/test_review_security_docs.py +117 -0
  81. logxide-0.3.0/tests/test_review_test_quality.py +203 -0
  82. logxide-0.3.0/tests/test_timed_rotation.py +131 -0
  83. {logxide-0.2.2 → logxide-0.3.0}/uv.lock +2 -2
  84. logxide-0.2.2/SECURITY.md +0 -237
  85. logxide-0.2.2/logxide/interceptor.py +0 -74
  86. logxide-0.2.2/tests/test_examples.py +0 -336
  87. logxide-0.2.2/tests/test_http_auth.py +0 -73
  88. logxide-0.2.2/tests/test_http_handler_features.py +0 -229
  89. logxide-0.2.2/tests/test_integration_examples.py +0 -369
  90. logxide-0.2.2/tests/test_overflow_flush.py +0 -256
  91. logxide-0.2.2/tests/test_timed_rotation.py +0 -145
  92. {logxide-0.2.2 → logxide-0.3.0}/.dockerignore +0 -0
  93. {logxide-0.2.2 → logxide-0.3.0}/.github/workflows/ci.yml +0 -0
  94. {logxide-0.2.2 → logxide-0.3.0}/.github/workflows/deploy_docs.yml +0 -0
  95. {logxide-0.2.2 → logxide-0.3.0}/.gitignore +0 -0
  96. {logxide-0.2.2 → logxide-0.3.0}/Dockerfile +0 -0
  97. {logxide-0.2.2 → logxide-0.3.0}/LICENSE +0 -0
  98. {logxide-0.2.2 → logxide-0.3.0}/MANIFEST.in +0 -0
  99. {logxide-0.2.2 → logxide-0.3.0}/benchmark/README.md +0 -0
  100. {logxide-0.2.2 → logxide-0.3.0}/benchmark/logger_comparison_file_io_20251230_165703.json +0 -0
  101. {logxide-0.2.2 → logxide-0.3.0}/clippy.toml +0 -0
  102. {logxide-0.2.2 → logxide-0.3.0}/docker-run.sh +0 -0
  103. {logxide-0.2.2 → logxide-0.3.0}/docs/assets/blog/blog-part1-cover.png +0 -0
  104. {logxide-0.2.2 → logxide-0.3.0}/docs/assets/blog/blog-part2-cover.png +0 -0
  105. {logxide-0.2.2 → logxide-0.3.0}/docs/integrations/django.md +0 -0
  106. {logxide-0.2.2 → logxide-0.3.0}/docs/integrations/flask.md +0 -0
  107. {logxide-0.2.2 → logxide-0.3.0}/docs/integrations/index.md +0 -0
  108. {logxide-0.2.2 → logxide-0.3.0}/docs/performance-bottleneck-report-2026-07-13.md +0 -0
  109. {logxide-0.2.2 → logxide-0.3.0}/examples/README.md +0 -0
  110. {logxide-0.2.2 → logxide-0.3.0}/examples/basic_usage.py +0 -0
  111. {logxide-0.2.2 → logxide-0.3.0}/examples/drop_in_replacement.py +0 -0
  112. {logxide-0.2.2 → logxide-0.3.0}/examples/fastapi_advanced.py +0 -0
  113. {logxide-0.2.2 → logxide-0.3.0}/examples/fastapi_demo.py +0 -0
  114. {logxide-0.2.2 → logxide-0.3.0}/examples/format_detailed.py +0 -0
  115. {logxide-0.2.2 → logxide-0.3.0}/examples/format_json.py +0 -0
  116. {logxide-0.2.2 → logxide-0.3.0}/examples/format_minimal.py +0 -0
  117. {logxide-0.2.2 → logxide-0.3.0}/examples/format_production.py +0 -0
  118. {logxide-0.2.2 → logxide-0.3.0}/examples/format_simple.py +0 -0
  119. {logxide-0.2.2 → logxide-0.3.0}/examples/format_threaded.py +0 -0
  120. {logxide-0.2.2 → logxide-0.3.0}/examples/minimal_dropin.py +0 -0
  121. {logxide-0.2.2 → logxide-0.3.0}/examples/performance_demo.py +0 -0
  122. {logxide-0.2.2 → logxide-0.3.0}/examples/sentry_integration.py +0 -0
  123. {logxide-0.2.2 → logxide-0.3.0}/examples/simple_demo.py +0 -0
  124. {logxide-0.2.2 → logxide-0.3.0}/examples/third_party_integration.py +0 -0
  125. {logxide-0.2.2 → logxide-0.3.0}/logxide/py.typed +0 -0
  126. {logxide-0.2.2 → logxide-0.3.0}/logxide/pytest_plugin.py +0 -0
  127. {logxide-0.2.2 → logxide-0.3.0}/logxide/sentry_integration.py +0 -0
  128. {logxide-0.2.2 → logxide-0.3.0}/mkdocs.yml +0 -0
  129. {logxide-0.2.2 → logxide-0.3.0}/rust-toolchain.toml +0 -0
  130. {logxide-0.2.2 → logxide-0.3.0}/scripts/README.md +0 -0
  131. {logxide-0.2.2 → logxide-0.3.0}/scripts/clippy-check.sh +0 -0
  132. {logxide-0.2.2 → logxide-0.3.0}/scripts/publish.py +0 -0
  133. {logxide-0.2.2 → logxide-0.3.0}/scripts/verify_package.py +0 -0
  134. {logxide-0.2.2 → logxide-0.3.0}/social_preview.png +0 -0
  135. {logxide-0.2.2 → logxide-0.3.0}/src/config.rs +0 -0
  136. {logxide-0.2.2 → logxide-0.3.0}/src/filter.rs +0 -0
  137. {logxide-0.2.2 → logxide-0.3.0}/standalone_test.py +0 -0
  138. {logxide-0.2.2 → logxide-0.3.0}/test.db +0 -0
  139. {logxide-0.2.2 → logxide-0.3.0}/tests/docker-compose.sentry.yml +0 -0
  140. {logxide-0.2.2 → logxide-0.3.0}/tests/test_basic_logging.py +0 -0
  141. {logxide-0.2.2 → logxide-0.3.0}/tests/test_caller_info_scope.py +0 -0
  142. {logxide-0.2.2 → logxide-0.3.0}/tests/test_caplog_override.py +0 -0
  143. {logxide-0.2.2 → logxide-0.3.0}/tests/test_color_formatter.py +0 -0
  144. {logxide-0.2.2 → logxide-0.3.0}/tests/test_compat_functions.py +0 -0
  145. {logxide-0.2.2 → logxide-0.3.0}/tests/test_compatibility.py +0 -0
  146. {logxide-0.2.2 → logxide-0.3.0}/tests/test_config.py +0 -0
  147. {logxide-0.2.2 → logxide-0.3.0}/tests/test_formatter_planning.py +0 -0
  148. {logxide-0.2.2 → logxide-0.3.0}/tests/test_handler_output.py +0 -0
  149. {logxide-0.2.2 → logxide-0.3.0}/tests/test_handler_routing.py +0 -0
  150. {logxide-0.2.2 → logxide-0.3.0}/tests/test_integration.py +0 -0
  151. {logxide-0.2.2 → logxide-0.3.0}/tests/test_integration_simple.py +0 -0
  152. {logxide-0.2.2 → logxide-0.3.0}/tests/test_logxide_testing.py +0 -0
  153. {logxide-0.2.2 → logxide-0.3.0}/tests/test_python315_compat.py +0 -0
  154. {logxide-0.2.2 → logxide-0.3.0}/tests/test_sentry_integration.py +0 -0
  155. {logxide-0.2.2 → logxide-0.3.0}/tests/test_simple.py +0 -0
  156. {logxide-0.2.2 → logxide-0.3.0}/tmp_test_intercept.py +0 -0
@@ -64,5 +64,5 @@ jobs:
64
64
  name: benchmark-results-py${{ matrix.python-version }}
65
65
  path: |
66
66
  benchmark/perf_results/
67
- basic_handlers_benchmark_*.json
67
+ benchmark/basic_handlers_benchmark_*.json
68
68
  if-no-files-found: ignore
@@ -22,6 +22,7 @@ jobs:
22
22
  runs-on: ${{ matrix.platform.runner }}
23
23
  strategy:
24
24
  matrix:
25
+ python-version: ['3.12', '3.13', '3.14']
25
26
  platform:
26
27
  - runner: ubuntu-22.04
27
28
  target: x86_64
@@ -37,15 +38,12 @@ jobs:
37
38
  target: ppc64le
38
39
  steps:
39
40
  - uses: actions/checkout@v4
40
- - uses: actions/setup-python@v5
41
- id: setup-python
42
- with:
43
- python-version: '3.12'
44
41
  - name: Build wheels
45
42
  uses: PyO3/maturin-action@v1
46
43
  with:
47
44
  target: ${{ matrix.platform.target }}
48
- args: --release --out dist -i python3.12
45
+ # Resolve the interpreter inside the manylinux build environment.
46
+ args: --release --out dist -i python${{ matrix.python-version }}
49
47
  sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
50
48
  manylinux: auto
51
49
  env:
@@ -57,7 +55,7 @@ jobs:
57
55
  - name: Upload wheels
58
56
  uses: actions/upload-artifact@v4
59
57
  with:
60
- name: wheels-linux-${{ matrix.platform.target }}
58
+ name: wheels-linux-${{ matrix.platform.target }}-py${{ matrix.python-version }}
61
59
  path: dist
62
60
 
63
61
  windows:
@@ -8,7 +8,7 @@ repos:
8
8
  - id: check-toml
9
9
 
10
10
  - repo: https://github.com/astral-sh/ruff-pre-commit
11
- rev: v0.9.7
11
+ rev: v0.12.3
12
12
  hooks:
13
13
  - id: ruff-format
14
14
  - id: ruff
@@ -7,6 +7,32 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.3.0] - 2026-09-05
11
+
12
+ ### Added
13
+ - **Pre-import stdlib log capture and interception helper (`logxide.interceptor`).** Safely captures and forwards logs emitted before LogXide initialization.
14
+ - **Full numeric and custom log level routing.** Native core preserves integer log levels across Python and Rust boundaries, honoring `propagate` and `disable` inclusive thresholds.
15
+ - **Bounded HTTP and OTLP transports.** Transport queues enforce bounded size and timeouts, failing closed on transform/serialization errors with accurate delivery accounting and zero payload leaks.
16
+ - **Executable documentation test suite.** Root documentation and README code examples are continuously validated via dedicated test suites.
17
+
18
+ ### Fixed
19
+ - **Native error preservation and crash prevention.** Malformed message formatting and date strings no longer abort the process; log rotation rename failures preserve existing log bytes.
20
+ - **Python stdlib `logging` compatibility.**
21
+ - `logging.FileHandler` delayed initialization (`delay=True`) and custom encodings (e.g., `utf-16`) are properly wrapped and preserved.
22
+ - `FastLoggerWrapper.exception()` forwards `stack_info=True` and `exc_info` without losing traceback frames.
23
+ - `logging.removeHandler()` mirrors into native dispatch; `uninstall()` cleanly restores original module state.
24
+ - Formatters support `%`, `{`, and `$` styles with precise percent precision conversion and escaped `%` handling.
25
+ - Timed rotation configurations and gzip compression work reliably.
26
+ - **Benchmark integrity and accounting.**
27
+ - Benchmark orchestrators exit with non-zero status on worker crashes or sink mismatches instead of masking errors.
28
+ - Async benchmark accounting enforces drain and delivery verification.
29
+ - **Test determinism.** Eliminated timing luck and sleep-based polling in async test suites.
30
+
31
+ ### Documentation & Packaging
32
+ - Corrected masking recipes, security policies, and removed unverified claims.
33
+ - Updated CI matrix to cover supported Linux Python interpreters and Docker benchmark entry points.
34
+ - Reconciled Ruff 0.12.3 and Pyright tooling configurations.
35
+
10
36
  ## [0.2.2] - 2026-07-14
11
37
 
12
38
  ### Performance
@@ -460,7 +486,7 @@ Versus Python stdlib `logging` (subprocess, 100K iter × 3 runs, FileHandler):
460
486
 
461
487
  LogXide follows semantic versioning:
462
488
  - **Major versions** (x.0.0): Breaking API changes
463
- - **Minor versions** (0.x.0): New features, backward compatible
489
+ - **Minor versions before 1.0** (0.x.0): May include breaking API changes; review migration notes before upgrading
464
490
  - **Patch versions** (0.0.x): Bug fixes, backward compatible
465
491
 
466
492
  ### Support
@@ -25,13 +25,13 @@ LogXide is a Rust-based Python extension that provides high-performance logging.
25
25
  - Experience with Rust programming
26
26
  - Familiarity with Python and its logging module
27
27
  - Understanding of PyO3 for Python-Rust bindings
28
- - Knowledge of async programming (Tokio)
28
+ - Familiarity with background-worker concurrency (the handlers use `crossbeam-channel` worker threads, not an async runtime)
29
29
 
30
30
  ## Development Setup
31
31
 
32
32
  ### Prerequisites
33
33
 
34
- - Rust 1.70 or later
34
+ - Rust via [rustup](https://rustup.rs/): the repo pins channel **1.88.0** in `rust-toolchain.toml` (the chosen build toolchain, not a verified MSRV); rustup installs it automatically
35
35
  - Python 3.12 or later
36
36
  - Git
37
37
 
@@ -52,7 +52,7 @@ LogXide is a Rust-based Python extension that provides high-performance logging.
52
52
 
53
53
  4. Install development dependencies:
54
54
  ```bash
55
- pip install maturin pytest pytest-cov pytest-xdist ruff mypy
55
+ pip install -e '.[dev]' # pytest, pytest-timeout (required by the pytest config), pytest-cov, ruff, pre-commit, maturin
56
56
  ```
57
57
 
58
58
  5. Install pre-commit hooks:
@@ -245,7 +245,7 @@ LogXide uses a layered architecture:
245
245
 
246
246
  ### Performance Considerations
247
247
 
248
- - **Async by Default**: Use async patterns where possible
248
+ - **Offload blocking I/O**: handlers push work to background worker threads over bounded `crossbeam-channel` queues instead of blocking the caller; account for queue overflow in any new async path
249
249
  - **Minimize Allocations**: Avoid unnecessary memory allocations
250
250
  - **Efficient String Handling**: Use efficient string operations
251
251
  - **Benchmark New Features**: Measure performance impact
@@ -272,7 +272,7 @@ LogXide uses a layered architecture:
272
272
 
273
273
  ### Version Numbering
274
274
 
275
- LogXide follows [Semantic Versioning](https://semver.org/):
275
+ LogXide versions as MAJOR.MINOR.PATCH. While the project is 0.x, a **minor** release may include behavior-breaking changes (0.2.0's changed flush semantics and async overflow default shipped in a minor bump; see the CHANGELOG). After 1.0:
276
276
 
277
277
  - **MAJOR**: Breaking changes
278
278
  - **MINOR**: New features, backward compatible
@@ -291,7 +291,7 @@ LogXide follows [Semantic Versioning](https://semver.org/):
291
291
  - **Documentation**: Check the README and docs
292
292
  - **Issues**: Search existing issues
293
293
  - **Discussions**: Use GitHub Discussions for questions
294
- - **Email**: Contact maintainers at logxide@example.com
294
+ - **Email**: Contact the maintainers at freedomzero91@gmail.com (the address declared in `pyproject.toml`)
295
295
 
296
296
  ## Recognition
297
297
 
@@ -709,7 +709,7 @@ checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
709
709
 
710
710
  [[package]]
711
711
  name = "logxide"
712
- version = "0.2.2"
712
+ version = "0.3.0"
713
713
  dependencies = [
714
714
  "arc-swap",
715
715
  "chrono",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "logxide"
3
- version = "0.2.2"
3
+ version = "0.3.0"
4
4
  edition = "2021"
5
5
  readme = "README.md"
6
6
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: logxide
3
- Version: 0.2.2
3
+ Version: 0.3.0
4
4
  Classifier: Development Status :: 4 - Beta
5
5
  Classifier: Intended Audience :: Developers
6
6
  Classifier: License :: OSI Approved :: MIT License
@@ -17,7 +17,7 @@ Classifier: Typing :: Typed
17
17
  Requires-Dist: pytest ; extra == 'dev'
18
18
  Requires-Dist: pytest-cov ; extra == 'dev'
19
19
  Requires-Dist: pyright ; extra == 'dev'
20
- Requires-Dist: ruff ; extra == 'dev'
20
+ Requires-Dist: ruff==0.12.3 ; extra == 'dev'
21
21
  Requires-Dist: pre-commit ; extra == 'dev'
22
22
  Requires-Dist: maturin>=1.0,<2.0 ; extra == 'dev'
23
23
  Requires-Dist: mkdocs ; extra == 'dev'
@@ -52,17 +52,20 @@ Project-URL: Source Code, https://github.com/Indosaram/logxide
52
52
 
53
53
  # LogXide
54
54
 
55
- **Several-fold faster than stdlib logging (roughly 5–11× on file logging, scenario- and machine-dependent), sink-verified. Powered by Rust.**
55
+ **In the historical [sink-verified benchmark runs](docs/benchmarks.md) documented in this repository, LogXide measured several-fold faster than stdlib logging: roughly 5–11× on file logging, scenario- and machine-dependent. That is a record of those runs, not a guarantee for every workload. Powered by Rust.**
56
56
 
57
57
  Familiar stdlib-style API — for common patterns, change one import and `getLogger`, format strings, and handlers work as expected. It's a **near**-drop-in, not a strict one: some advanced stdlib behaviors differ (flush now drains/waits, `LogRecord`/`Logger` can't be subclassed, custom `Formatter` subclasses fall back to a slower path). See [compatibility](docs/compatibility.md).
58
58
 
59
59
  ```python
60
- # Before # After
61
- import logging from logxide import logging
60
+ # Before
61
+ import logging
62
+
63
+ # After
64
+ from logxide import logging
62
65
 
63
66
  logging.basicConfig(level=logging.INFO)
64
67
  logger = logging.getLogger('myapp')
65
- logger.info('Hello, world!') # Common patterns: same code, several-fold faster.
68
+ logger.info('Hello, world!') # Same code. Historical benchmark results: see docs/benchmarks.md.
66
69
  ```
67
70
 
68
71
  [![PyPI](https://img.shields.io/pypi/v/logxide)](https://pypi.org/project/logxide/)
@@ -83,7 +86,7 @@ pip install logxide[sentry]
83
86
 
84
87
  ## Performance
85
88
 
86
- LogXide is performance-first: its native Rust handlers dispatch on the GIL-released fast path, formatting and writing without materializing a Python `LogRecord`. As of 0.2.0 the text-sink wrappers (`FileHandler`, `StreamHandler`, `RotatingFileHandler`) emit through that native Rust path **by default**; a handler only falls back to the Python path for a custom `Formatter` subclass, `{`/`$`-style format strings, or a handler-level Python filter.
89
+ LogXide is performance-first: its native Rust handlers dispatch on the GIL-released fast path, formatting and writing without materializing a Python `LogRecord`. As of 0.2.0 the text-sink wrappers (`FileHandler`, `StreamHandler`, `RotatingFileHandler`) emit through that native Rust path **by default**. A handler switches to the Python path for a custom `Formatter` subclass, `{`/`$`-style format strings, format features the native formatter doesn't replicate (precision like `%.2f`, escaped `%%`, or `%(asctime)s` with stdlib's default milliseconds), or a handler-level Python filter; a handler constructed with non-default file options (`mode`, `encoding`, `delay`, `errors`) or an arbitrary stream object skips the Rust writer entirely and runs the pure stdlib path. Behavior stays stdlib-correct on all of these paths, only speed changes. See [compatibility](docs/compatibility.md).
87
90
 
88
91
  ### Benchmarks
89
92
 
@@ -131,6 +134,8 @@ LogXide intercepts stdlib logging — most libraries work without changes.
131
134
 
132
135
  [Full compatibility guide for 20+ libraries →](docs/third-party-compatibility.md)
133
136
 
137
+ > Statuses above describe the shipped releases. Lifecycle corrections (propagation, handler removal, repeat-interception edge cases) are in flight on a separate work stream and are not yet re-verified, so treat an edge-case interception claim as pending until that work lands; the detailed guide notes per-library caveats.
138
+
134
139
  ## Built-in Sentry Integration
135
140
 
136
141
  No extra handlers. No configuration. Just works.
@@ -241,11 +246,13 @@ LogXide reimplements Python's logging in Rust for speed. The API is the same, bu
241
246
  ```bash
242
247
  git clone https://github.com/Indosaram/logxide
243
248
  cd logxide
244
- pip install maturin
249
+ pip install -e '.[dev]' # includes pytest-timeout, required by the pytest config
245
250
  maturin develop
246
251
  pytest tests/
247
252
  ```
248
253
 
254
+ The Rust toolchain is pinned to 1.88.0 in `rust-toolchain.toml`; rustup installs it automatically. This is the version the project builds with, not a verified minimum supported version.
255
+
249
256
  See [development guide](docs/development.md) for details.
250
257
 
251
258
  ## License
@@ -1,16 +1,19 @@
1
1
  # LogXide
2
2
 
3
- **Several-fold faster than stdlib logging (roughly 5–11× on file logging, scenario- and machine-dependent), sink-verified. Powered by Rust.**
3
+ **In the historical [sink-verified benchmark runs](docs/benchmarks.md) documented in this repository, LogXide measured several-fold faster than stdlib logging: roughly 5–11× on file logging, scenario- and machine-dependent. That is a record of those runs, not a guarantee for every workload. Powered by Rust.**
4
4
 
5
5
  Familiar stdlib-style API — for common patterns, change one import and `getLogger`, format strings, and handlers work as expected. It's a **near**-drop-in, not a strict one: some advanced stdlib behaviors differ (flush now drains/waits, `LogRecord`/`Logger` can't be subclassed, custom `Formatter` subclasses fall back to a slower path). See [compatibility](docs/compatibility.md).
6
6
 
7
7
  ```python
8
- # Before # After
9
- import logging from logxide import logging
8
+ # Before
9
+ import logging
10
+
11
+ # After
12
+ from logxide import logging
10
13
 
11
14
  logging.basicConfig(level=logging.INFO)
12
15
  logger = logging.getLogger('myapp')
13
- logger.info('Hello, world!') # Common patterns: same code, several-fold faster.
16
+ logger.info('Hello, world!') # Same code. Historical benchmark results: see docs/benchmarks.md.
14
17
  ```
15
18
 
16
19
  [![PyPI](https://img.shields.io/pypi/v/logxide)](https://pypi.org/project/logxide/)
@@ -31,7 +34,7 @@ pip install logxide[sentry]
31
34
 
32
35
  ## Performance
33
36
 
34
- LogXide is performance-first: its native Rust handlers dispatch on the GIL-released fast path, formatting and writing without materializing a Python `LogRecord`. As of 0.2.0 the text-sink wrappers (`FileHandler`, `StreamHandler`, `RotatingFileHandler`) emit through that native Rust path **by default**; a handler only falls back to the Python path for a custom `Formatter` subclass, `{`/`$`-style format strings, or a handler-level Python filter.
37
+ LogXide is performance-first: its native Rust handlers dispatch on the GIL-released fast path, formatting and writing without materializing a Python `LogRecord`. As of 0.2.0 the text-sink wrappers (`FileHandler`, `StreamHandler`, `RotatingFileHandler`) emit through that native Rust path **by default**. A handler switches to the Python path for a custom `Formatter` subclass, `{`/`$`-style format strings, format features the native formatter doesn't replicate (precision like `%.2f`, escaped `%%`, or `%(asctime)s` with stdlib's default milliseconds), or a handler-level Python filter; a handler constructed with non-default file options (`mode`, `encoding`, `delay`, `errors`) or an arbitrary stream object skips the Rust writer entirely and runs the pure stdlib path. Behavior stays stdlib-correct on all of these paths, only speed changes. See [compatibility](docs/compatibility.md).
35
38
 
36
39
  ### Benchmarks
37
40
 
@@ -79,6 +82,8 @@ LogXide intercepts stdlib logging — most libraries work without changes.
79
82
 
80
83
  [Full compatibility guide for 20+ libraries →](docs/third-party-compatibility.md)
81
84
 
85
+ > Statuses above describe the shipped releases. Lifecycle corrections (propagation, handler removal, repeat-interception edge cases) are in flight on a separate work stream and are not yet re-verified, so treat an edge-case interception claim as pending until that work lands; the detailed guide notes per-library caveats.
86
+
82
87
  ## Built-in Sentry Integration
83
88
 
84
89
  No extra handlers. No configuration. Just works.
@@ -189,11 +194,13 @@ LogXide reimplements Python's logging in Rust for speed. The API is the same, bu
189
194
  ```bash
190
195
  git clone https://github.com/Indosaram/logxide
191
196
  cd logxide
192
- pip install maturin
197
+ pip install -e '.[dev]' # includes pytest-timeout, required by the pytest config
193
198
  maturin develop
194
199
  pytest tests/
195
200
  ```
196
201
 
202
+ The Rust toolchain is pinned to 1.88.0 in `rust-toolchain.toml`; rustup installs it automatically. This is the version the project builds with, not a verified minimum supported version.
203
+
197
204
  See [development guide](docs/development.md) for details.
198
205
 
199
206
  ## License
@@ -0,0 +1,257 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ The current repository version is **0.3.0**, as declared in `pyproject.toml`.
6
+ This policy does not establish a guaranteed security-support period or a backport
7
+ commitment for any release line. Include the affected version in your report;
8
+ maintainers will need to determine which releases require a fix.
9
+
10
+ ## Reporting a Vulnerability
11
+
12
+ We take security vulnerabilities seriously. If you discover a security vulnerability in LogXide, please report it privately to allow us to fix it before public disclosure.
13
+
14
+ ### How to Report
15
+
16
+ **Please do NOT report security vulnerabilities through public GitHub issues.**
17
+
18
+ Contact the repository-declared maintainer at **freedomzero91@gmail.com** (from
19
+ `pyproject.toml`). Delivery to this address has not been verified by this policy.
20
+ Start with a brief description and ask how to share sensitive reproduction data;
21
+ do not include live credentials or unnecessary personal data.
22
+
23
+ GitHub private vulnerability reporting enablement has not been verified. A login
24
+ page at the reporting URL is not confirmation that the feature is enabled. Do not
25
+ rely on that route unless GitHub actually offers private reporting for this
26
+ repository after you sign in.
27
+
28
+ Include the following information:
29
+
30
+ 1. **Type of vulnerability**: Brief description of the vulnerability type
31
+ 2. **Location**: Where in the codebase the vulnerability exists
32
+ 3. **Impact**: Potential impact and severity
33
+ 4. **Reproduction**: Step-by-step instructions to reproduce the issue
34
+ 5. **Fix suggestion**: If you have ideas for fixing the vulnerability
35
+ 6. **Contact**: Your preferred contact method for follow-up
36
+
37
+ ### What to Expect
38
+
39
+ There is no guaranteed acknowledgment, assessment, or remediation deadline.
40
+ Coordinate disclosure and any desired attribution with the maintainer; indicate
41
+ whether you prefer to remain anonymous. Do not assume receipt until you receive
42
+ a response.
43
+
44
+ ## Security Considerations
45
+
46
+ ### LogXide Design Principles
47
+
48
+ 1. **Rust and Python**: Rust's safety checks reduce some memory-safety risks;
49
+ they are not a guarantee that the bindings or dependencies are vulnerability-free.
50
+ 2. **Application input**: Messages are not automatically sanitized or redacted.
51
+ Applications must choose what data to log and how to handle untrusted input.
52
+ 3. **Destinations**: File and stream logging need no network destination, but
53
+ configured HTTP, OTLP, and integration handlers can transmit logs externally.
54
+ 4. **Deployment**: Review destination access, file permissions, retention, and
55
+ dependency updates for your application rather than assuming secure defaults.
56
+
57
+ ### Potential Security Concerns
58
+
59
+ While LogXide is designed to be secure, be aware of these potential concerns:
60
+
61
+ #### 1. Log Injection
62
+ - **Risk**: Malicious input in log messages could lead to log injection attacks
63
+ - **Mitigation**: Validate and sanitize all log inputs
64
+ - **Example**:
65
+ ```python
66
+ # Bad: Direct user input
67
+ logger.info(f"User logged in: {user_input}")
68
+
69
+ # Good: Sanitized input
70
+ logger.info("User logged in: %s", sanitize(user_input))
71
+ ```
72
+
73
+ #### 2. Information Disclosure
74
+ - **Risk**: Sensitive information in log messages could be exposed
75
+ - **Mitigation**: Avoid logging sensitive data like passwords, API keys, personal information
76
+ - **Example**:
77
+ ```python
78
+ # Bad: Logging sensitive data
79
+ logger.info(f"Password: {password}")
80
+
81
+ # Good: Logging without sensitive data
82
+ logger.info("Authentication successful for user: %s", username)
83
+ ```
84
+
85
+ #### 3. Log File Permissions
86
+ - **Risk**: Log files with incorrect permissions could expose sensitive information
87
+ - **Mitigation**: Ensure log files have appropriate permissions (e.g., 600 or 640)
88
+ - **Note**: LogXide doesn't manage file permissions directly; this is the responsibility of the application
89
+
90
+ #### 4. Log Flooding
91
+ - **Risk**: Excessive logging could lead to disk space exhaustion or performance issues
92
+ - **Mitigation**: Implement rate limiting and log rotation
93
+ - **Example**:
94
+ ```python
95
+ # Be careful with loops and error conditions
96
+ for item in large_list:
97
+ try:
98
+ process(item)
99
+ except Exception:
100
+ logger.error("Failed to process item: %s", item) # Could flood logs
101
+ ```
102
+
103
+ #### 5. Format String Vulnerabilities
104
+ - **Risk**: User-controlled format strings could lead to vulnerabilities
105
+ - **Mitigation**: Never use user input directly as format strings
106
+ - **Example**:
107
+ ```python
108
+ # Bad: User-controlled format string
109
+ logger.info(user_format_string % data)
110
+
111
+ # Good: Safe logging
112
+ logger.info("User action: %s", user_action)
113
+ ```
114
+
115
+ ### Best Practices
116
+
117
+ #### 1. Input Sanitization
118
+ ```python
119
+ import re
120
+
121
+ def sanitize_log_input(input_string):
122
+ """Remove potentially dangerous characters from log input."""
123
+ # Remove control characters and non-printable characters
124
+ return re.sub(r'[\x00-\x1f\x7f-\x9f]', '', str(input_string))
125
+
126
+ # Usage
127
+ logger.info("User input: %s", sanitize_log_input(user_input))
128
+ ```
129
+
130
+ #### 2. Structured Logging
131
+ ```python
132
+ # Use structured logging to separate data from format
133
+ logger.info("User action", extra={
134
+ 'user_id': user_id,
135
+ 'action': action,
136
+ 'timestamp': timestamp
137
+ })
138
+ ```
139
+
140
+ #### 3. Log Level Management
141
+ ```python
142
+ # Use appropriate log levels
143
+ logger.debug("Detailed debugging info") # Development only
144
+ logger.info("General information") # Production safe
145
+ logger.warning("Warning condition") # Attention needed
146
+ logger.error("Error condition") # Requires action
147
+ logger.critical("Critical condition") # Immediate action required
148
+ ```
149
+
150
+ #### 4. Sensitive Data Handling
151
+
152
+ Prefer not to log secrets at all. This example creates an application logger and
153
+ masks case-insensitive `password=` fields whose values contain no
154
+ whitespace, including punctuation. It handles literal messages and `%`-style
155
+ parameters by rendering `record.getMessage()` before masking and clearing `args`.
156
+ It is not a general secret detector: quoted values containing spaces, other field
157
+ names, `extra` fields, exception text, and stack traces need separate treatment.
158
+
159
+ Use the Python-compatible `logxide.handlers.StreamHandler` wrapper, not a direct
160
+ Rust handler or a logger-level filter. Native logger filters receive a dictionary
161
+ with raw `msg` and no `args`, so they cannot safely redact interpolated values.
162
+ Adding a handler filter selects Python fallback. The `IsolatedStreamHandler`
163
+ subclass below copies each record before running filters so other handlers do
164
+ not see its mutations; the base wrapper does not provide this isolation.
165
+
166
+ ```python
167
+ import copy
168
+ import re
169
+
170
+ from logxide import getLogger
171
+ from logxide.handlers import StreamHandler
172
+
173
+
174
+ class SensitiveDataFilter:
175
+ def filter(self, record):
176
+ record.msg = re.sub(
177
+ r"(?i)\b(password=)\S+", r"\1***", record.getMessage()
178
+ )
179
+ record.args = ()
180
+ return True
181
+
182
+
183
+ class IsolatedStreamHandler(StreamHandler):
184
+ def handle(self, record):
185
+ return super().handle(copy.copy(record))
186
+
187
+
188
+ logger = getLogger("security.recipe")
189
+ handler = IsolatedStreamHandler()
190
+ handler.addFilter(SensitiveDataFilter())
191
+ logger.addHandler(handler)
192
+ ```
193
+
194
+ Only this handler's output is masked. Replace unfiltered sinks or apply an
195
+ equivalent policy to every destination, including propagated/root handlers;
196
+ adding this handler does not protect existing destinations. Use `handle()`, not
197
+ `emit()`, when delivering records directly so filters run. Remove, flush, and
198
+ close the handler when your application no longer needs it.
199
+
200
+ ### Security Testing
201
+
202
+ The CI workflow (`.github/workflows/ci.yml`) defines lint/type checks, tests, and
203
+ `cargo audit`. This describes configured checks, not a guarantee that a particular
204
+ run passed or that all security issues are detected. No regular fuzzing program
205
+ or independent security-audit schedule is established by this policy.
206
+
207
+ ### Dependency Security
208
+
209
+ `pyproject.toml` declares no required Python package dependencies, but the native
210
+ extension uses Rust dependencies listed in `Cargo.toml` and pinned in `Cargo.lock`.
211
+ Optional integrations add their own dependencies. Review advisories for the full
212
+ dependency set; a configured `cargo audit` check is not a comprehensive audit or a
213
+ claim that dependencies have been independently vetted.
214
+
215
+ ### Vulnerability Disclosure
216
+
217
+ Discuss private handling, disclosure timing, attribution, and any advisory or CVE
218
+ with the maintainer for the specific report. This policy does not promise a
219
+ particular disclosure workflow or CVE assignment.
220
+
221
+ ## Security Updates
222
+
223
+ ### Notification Methods
224
+
225
+ Check [repository releases](https://github.com/Indosaram/logxide/releases) and
226
+ [`CHANGELOG.md`](CHANGELOG.md) for published changes. No dedicated security
227
+ mailing list or security RSS feed is declared here.
228
+
229
+ ### Updating Dependencies
230
+
231
+ The following are manual update commands, not an automatic security-update
232
+ service. Use the command for your environment, review the resulting version and
233
+ lockfile, and test compatibility before deployment:
234
+
235
+ ```bash
236
+ # For a pip-managed environment
237
+ pip install --upgrade logxide
238
+
239
+ # Or use pipenv
240
+ pipenv update logxide
241
+
242
+ # Or use poetry
243
+ poetry update logxide
244
+ ```
245
+
246
+ ## Contact
247
+
248
+ For security-related questions or concerns:
249
+
250
+ - **Maintainer email**: freedomzero91@gmail.com, as declared in `pyproject.toml`;
251
+ delivery is unverified.
252
+ - **Encrypted reporting**: No PGP key is published in this policy. Agree on a
253
+ suitable channel before sending sensitive data.
254
+
255
+ ---
256
+
257
+ **Remember**: Security is a shared responsibility. While LogXide is designed to be secure, proper usage and deployment practices are essential for maintaining security in your applications.
@@ -319,8 +319,18 @@ def run_worker(
319
319
  r.error = (proc.stderr or "worker failed").strip()[-500:]
320
320
  else:
321
321
  r.error = "no RESULT_JSON emitted; stderr=" + (proc.stderr or "")[-300:]
322
- return result if result else r
322
+ return r
323
323
 
324
+ if proc.returncode != 0:
325
+ # A worker that emitted RESULT_JSON but exited nonzero is not
326
+ # trustworthy: reject it even if the payload claims success or skip.
327
+ result.ok = False
328
+ result.skipped = False
329
+ rc_note = f"worker exited with code {proc.returncode}"
330
+ result.error = f"{result.error}; {rc_note}" if result.error else rc_note
331
+ tail = (proc.stderr or "").strip()[-200:]
332
+ if tail:
333
+ result.error += f": {tail}"
324
334
  return result
325
335
 
326
336