logxide 0.2.0__tar.gz → 0.2.2__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 (137) hide show
  1. logxide-0.2.2/.github/workflows/benchmark.yml +68 -0
  2. {logxide-0.2.0 → logxide-0.2.2}/CHANGELOG.md +70 -0
  3. {logxide-0.2.0 → logxide-0.2.2}/Cargo.lock +1 -1
  4. {logxide-0.2.0 → logxide-0.2.2}/Cargo.toml +1 -1
  5. {logxide-0.2.0 → logxide-0.2.2}/PKG-INFO +25 -23
  6. {logxide-0.2.0 → logxide-0.2.2}/README.md +23 -21
  7. {logxide-0.2.0 → logxide-0.2.2}/docs/benchmarks.md +43 -57
  8. {logxide-0.2.0 → logxide-0.2.2}/docs/blog-preview/part1.md +8 -8
  9. {logxide-0.2.0 → logxide-0.2.2}/docs/blog-preview/part2.md +1 -1
  10. {logxide-0.2.0 → logxide-0.2.2}/docs/comparison-picologging.md +1 -1
  11. {logxide-0.2.0 → logxide-0.2.2}/docs/comparison-stdlib.md +16 -16
  12. {logxide-0.2.0 → logxide-0.2.2}/docs/comparison-structlog.md +7 -7
  13. {logxide-0.2.0 → logxide-0.2.2}/docs/comparison.md +7 -7
  14. {logxide-0.2.0 → logxide-0.2.2}/docs/index.md +2 -2
  15. {logxide-0.2.0 → logxide-0.2.2}/docs/integrations/sentry.md +1 -1
  16. {logxide-0.2.0 → logxide-0.2.2}/logxide/__init__.py +4 -2
  17. {logxide-0.2.0 → logxide-0.2.2}/logxide/module_system.py +8 -0
  18. {logxide-0.2.0 → logxide-0.2.2}/pyproject.toml +2 -2
  19. {logxide-0.2.0 → logxide-0.2.2}/src/formatter.rs +27 -8
  20. {logxide-0.2.0 → logxide-0.2.2}/src/globals.rs +9 -6
  21. {logxide-0.2.0 → logxide-0.2.2}/src/py_logger.rs +20 -7
  22. logxide-0.2.2/tests/test_caller_info_scope.py +90 -0
  23. {logxide-0.2.0 → logxide-0.2.2}/tests/test_handler_output.py +44 -0
  24. {logxide-0.2.0 → logxide-0.2.2}/tests/test_native_fastpath.py +6 -1
  25. {logxide-0.2.0 → logxide-0.2.2}/tests/test_overflow_flush.py +7 -1
  26. {logxide-0.2.0 → logxide-0.2.2}/.dockerignore +0 -0
  27. {logxide-0.2.0 → logxide-0.2.2}/.github/workflows/ci.yml +0 -0
  28. {logxide-0.2.0 → logxide-0.2.2}/.github/workflows/deploy_docs.yml +0 -0
  29. {logxide-0.2.0 → logxide-0.2.2}/.github/workflows/publish.yml +0 -0
  30. {logxide-0.2.0 → logxide-0.2.2}/.gitignore +0 -0
  31. {logxide-0.2.0 → logxide-0.2.2}/.pre-commit-config.yaml +0 -0
  32. {logxide-0.2.0 → logxide-0.2.2}/CONTRIBUTING.md +0 -0
  33. {logxide-0.2.0 → logxide-0.2.2}/Dockerfile +0 -0
  34. {logxide-0.2.0 → logxide-0.2.2}/LICENSE +0 -0
  35. {logxide-0.2.0 → logxide-0.2.2}/MANIFEST.in +0 -0
  36. {logxide-0.2.0 → logxide-0.2.2}/SECURITY.md +0 -0
  37. {logxide-0.2.0 → logxide-0.2.2}/benchmark/README.md +0 -0
  38. {logxide-0.2.0 → logxide-0.2.2}/benchmark/_bench_common.py +0 -0
  39. {logxide-0.2.0 → logxide-0.2.2}/benchmark/basic_handlers_benchmark.py +0 -0
  40. {logxide-0.2.0 → logxide-0.2.2}/benchmark/compare_loggers.py +0 -0
  41. {logxide-0.2.0 → logxide-0.2.2}/benchmark/gil_benchmark.py +0 -0
  42. {logxide-0.2.0 → logxide-0.2.2}/benchmark/logger_comparison_file_io_20251230_165703.json +0 -0
  43. {logxide-0.2.0 → logxide-0.2.2}/benchmark/perf_micro.py +0 -0
  44. {logxide-0.2.0 → logxide-0.2.2}/benchmark/perf_vs_stdlib.py +0 -0
  45. {logxide-0.2.0 → logxide-0.2.2}/benchmark/real_handlers_comparison.py +0 -0
  46. {logxide-0.2.0 → logxide-0.2.2}/clippy.toml +0 -0
  47. {logxide-0.2.0 → logxide-0.2.2}/docker-compose.yml +0 -0
  48. {logxide-0.2.0 → logxide-0.2.2}/docker-run.sh +0 -0
  49. {logxide-0.2.0 → logxide-0.2.2}/docs/architecture.md +0 -0
  50. {logxide-0.2.0 → logxide-0.2.2}/docs/assets/blog/blog-part1-cover.png +0 -0
  51. {logxide-0.2.0 → logxide-0.2.2}/docs/assets/blog/blog-part2-cover.png +0 -0
  52. {logxide-0.2.0 → logxide-0.2.2}/docs/compatibility.md +0 -0
  53. {logxide-0.2.0 → logxide-0.2.2}/docs/development.md +0 -0
  54. {logxide-0.2.0 → logxide-0.2.2}/docs/installation.md +0 -0
  55. {logxide-0.2.0 → logxide-0.2.2}/docs/integrations/django.md +0 -0
  56. {logxide-0.2.0 → logxide-0.2.2}/docs/integrations/fastapi.md +0 -0
  57. {logxide-0.2.0 → logxide-0.2.2}/docs/integrations/flask.md +0 -0
  58. {logxide-0.2.0 → logxide-0.2.2}/docs/integrations/index.md +0 -0
  59. {logxide-0.2.0 → logxide-0.2.2}/docs/performance-bottleneck-report-2026-07-13.md +0 -0
  60. {logxide-0.2.0 → logxide-0.2.2}/docs/reference.md +0 -0
  61. {logxide-0.2.0 → logxide-0.2.2}/docs/testing.md +0 -0
  62. {logxide-0.2.0 → logxide-0.2.2}/docs/third-party-compatibility.md +0 -0
  63. {logxide-0.2.0 → logxide-0.2.2}/docs/usage.md +0 -0
  64. {logxide-0.2.0 → logxide-0.2.2}/examples/README.md +0 -0
  65. {logxide-0.2.0 → logxide-0.2.2}/examples/basic_usage.py +0 -0
  66. {logxide-0.2.0 → logxide-0.2.2}/examples/django_integration.py +0 -0
  67. {logxide-0.2.0 → logxide-0.2.2}/examples/drop_in_replacement.py +0 -0
  68. {logxide-0.2.0 → logxide-0.2.2}/examples/fastapi_advanced.py +0 -0
  69. {logxide-0.2.0 → logxide-0.2.2}/examples/fastapi_demo.py +0 -0
  70. {logxide-0.2.0 → logxide-0.2.2}/examples/flask_integration.py +0 -0
  71. {logxide-0.2.0 → logxide-0.2.2}/examples/format_detailed.py +0 -0
  72. {logxide-0.2.0 → logxide-0.2.2}/examples/format_json.py +0 -0
  73. {logxide-0.2.0 → logxide-0.2.2}/examples/format_minimal.py +0 -0
  74. {logxide-0.2.0 → logxide-0.2.2}/examples/format_production.py +0 -0
  75. {logxide-0.2.0 → logxide-0.2.2}/examples/format_simple.py +0 -0
  76. {logxide-0.2.0 → logxide-0.2.2}/examples/format_threaded.py +0 -0
  77. {logxide-0.2.0 → logxide-0.2.2}/examples/minimal_dropin.py +0 -0
  78. {logxide-0.2.0 → logxide-0.2.2}/examples/performance_demo.py +0 -0
  79. {logxide-0.2.0 → logxide-0.2.2}/examples/sentry_integration.py +0 -0
  80. {logxide-0.2.0 → logxide-0.2.2}/examples/simple_demo.py +0 -0
  81. {logxide-0.2.0 → logxide-0.2.2}/examples/third_party_integration.py +0 -0
  82. {logxide-0.2.0 → logxide-0.2.2}/logxide/__init__.pyi +0 -0
  83. {logxide-0.2.0 → logxide-0.2.2}/logxide/compat_functions.py +0 -0
  84. {logxide-0.2.0 → logxide-0.2.2}/logxide/compat_handlers.py +0 -0
  85. {logxide-0.2.0 → logxide-0.2.2}/logxide/config.py +0 -0
  86. {logxide-0.2.0 → logxide-0.2.2}/logxide/fast_logger_wrapper.py +0 -0
  87. {logxide-0.2.0 → logxide-0.2.2}/logxide/handlers.py +0 -0
  88. {logxide-0.2.0 → logxide-0.2.2}/logxide/interceptor.py +0 -0
  89. {logxide-0.2.0 → logxide-0.2.2}/logxide/logger_wrapper.py +0 -0
  90. {logxide-0.2.0 → logxide-0.2.2}/logxide/py.typed +0 -0
  91. {logxide-0.2.0 → logxide-0.2.2}/logxide/pytest_plugin.py +0 -0
  92. {logxide-0.2.0 → logxide-0.2.2}/logxide/sentry_integration.py +0 -0
  93. {logxide-0.2.0 → logxide-0.2.2}/logxide/testing.py +0 -0
  94. {logxide-0.2.0 → logxide-0.2.2}/mkdocs.yml +0 -0
  95. {logxide-0.2.0 → logxide-0.2.2}/pyrightconfig.json +0 -0
  96. {logxide-0.2.0 → logxide-0.2.2}/rust-toolchain.toml +0 -0
  97. {logxide-0.2.0 → logxide-0.2.2}/scripts/README.md +0 -0
  98. {logxide-0.2.0 → logxide-0.2.2}/scripts/clippy-check.sh +0 -0
  99. {logxide-0.2.0 → logxide-0.2.2}/scripts/publish.py +0 -0
  100. {logxide-0.2.0 → logxide-0.2.2}/scripts/verify_package.py +0 -0
  101. {logxide-0.2.0 → logxide-0.2.2}/social_preview.png +0 -0
  102. {logxide-0.2.0 → logxide-0.2.2}/src/config.rs +0 -0
  103. {logxide-0.2.0 → logxide-0.2.2}/src/core.rs +0 -0
  104. {logxide-0.2.0 → logxide-0.2.2}/src/fast_logger.rs +0 -0
  105. {logxide-0.2.0 → logxide-0.2.2}/src/filter.rs +0 -0
  106. {logxide-0.2.0 → logxide-0.2.2}/src/handler.rs +0 -0
  107. {logxide-0.2.0 → logxide-0.2.2}/src/lib.rs +0 -0
  108. {logxide-0.2.0 → logxide-0.2.2}/src/py_handlers.rs +0 -0
  109. {logxide-0.2.0 → logxide-0.2.2}/standalone_test.py +0 -0
  110. {logxide-0.2.0 → logxide-0.2.2}/test.db +0 -0
  111. {logxide-0.2.0 → logxide-0.2.2}/tests/conftest.py +0 -0
  112. {logxide-0.2.0 → logxide-0.2.2}/tests/docker-compose.sentry.yml +0 -0
  113. {logxide-0.2.0 → logxide-0.2.2}/tests/test_basic_logging.py +0 -0
  114. {logxide-0.2.0 → logxide-0.2.2}/tests/test_caplog_override.py +0 -0
  115. {logxide-0.2.0 → logxide-0.2.2}/tests/test_color_formatter.py +0 -0
  116. {logxide-0.2.0 → logxide-0.2.2}/tests/test_compat_functions.py +0 -0
  117. {logxide-0.2.0 → logxide-0.2.2}/tests/test_compatibility.py +0 -0
  118. {logxide-0.2.0 → logxide-0.2.2}/tests/test_config.py +0 -0
  119. {logxide-0.2.0 → logxide-0.2.2}/tests/test_doc_codeblocks.py +0 -0
  120. {logxide-0.2.0 → logxide-0.2.2}/tests/test_examples.py +0 -0
  121. {logxide-0.2.0 → logxide-0.2.2}/tests/test_formatter_planning.py +0 -0
  122. {logxide-0.2.0 → logxide-0.2.2}/tests/test_gil_scaling.py +0 -0
  123. {logxide-0.2.0 → logxide-0.2.2}/tests/test_handler_routing.py +0 -0
  124. {logxide-0.2.0 → logxide-0.2.2}/tests/test_http_auth.py +0 -0
  125. {logxide-0.2.0 → logxide-0.2.2}/tests/test_http_handler_features.py +0 -0
  126. {logxide-0.2.0 → logxide-0.2.2}/tests/test_integration.py +0 -0
  127. {logxide-0.2.0 → logxide-0.2.2}/tests/test_integration_examples.py +0 -0
  128. {logxide-0.2.0 → logxide-0.2.2}/tests/test_integration_simple.py +0 -0
  129. {logxide-0.2.0 → logxide-0.2.2}/tests/test_interceptor.py +0 -0
  130. {logxide-0.2.0 → logxide-0.2.2}/tests/test_logxide_testing.py +0 -0
  131. {logxide-0.2.0 → logxide-0.2.2}/tests/test_optimizations.py +0 -0
  132. {logxide-0.2.0 → logxide-0.2.2}/tests/test_python315_compat.py +0 -0
  133. {logxide-0.2.0 → logxide-0.2.2}/tests/test_sentry_integration.py +0 -0
  134. {logxide-0.2.0 → logxide-0.2.2}/tests/test_simple.py +0 -0
  135. {logxide-0.2.0 → logxide-0.2.2}/tests/test_timed_rotation.py +0 -0
  136. {logxide-0.2.0 → logxide-0.2.2}/tmp_test_intercept.py +0 -0
  137. {logxide-0.2.0 → logxide-0.2.2}/uv.lock +0 -0
@@ -0,0 +1,68 @@
1
+ name: Benchmarks
2
+
3
+ # Reproducible, environment-matched benchmark runs on CI shared runners.
4
+ # Manual (workflow_dispatch) and a weekly schedule — NOT on every push, since
5
+ # shared-runner numbers are noisy and are meant as a documented, re-runnable
6
+ # reference rather than a per-commit gate. The clean CI venv has no sentry-sdk,
7
+ # so it inherently avoids the caller-info measurement artifact fixed in 0.2.1.
8
+
9
+ on:
10
+ workflow_dispatch:
11
+ schedule:
12
+ - cron: "0 6 * * 1" # Mondays 06:00 UTC
13
+
14
+ env:
15
+ FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
16
+
17
+ jobs:
18
+ benchmark:
19
+ name: Benchmark (durable, sink-verified)
20
+ runs-on: ubuntu-latest
21
+ timeout-minutes: 30
22
+ strategy:
23
+ fail-fast: false
24
+ matrix:
25
+ python-version: ["3.12", "3.14"]
26
+ steps:
27
+ - uses: actions/checkout@v4
28
+ - name: Set up Python ${{ matrix.python-version }}
29
+ uses: actions/setup-python@v5
30
+ with:
31
+ python-version: ${{ matrix.python-version }}
32
+ - name: Set up Rust
33
+ uses: dtolnay/rust-toolchain@stable
34
+ with:
35
+ toolchain: 1.88.0
36
+ - name: Cache Rust dependencies
37
+ uses: actions/cache@v4
38
+ with:
39
+ path: |
40
+ ~/.cargo/registry
41
+ ~/.cargo/git
42
+ target
43
+ key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }}
44
+ - name: Install build deps
45
+ run: |
46
+ python -m pip install --upgrade uv
47
+ uv venv
48
+ uv pip install maturin
49
+ - name: Build and install (release)
50
+ env:
51
+ PYO3_USE_ABI3_FORWARD_COMPATIBILITY: 1
52
+ run: uv run maturin develop --release
53
+ - name: Confirm clean environment (no sentry-sdk)
54
+ run: |
55
+ uv run python -c "import importlib.util as u; assert u.find_spec('sentry_sdk') is None, 'sentry-sdk must NOT be installed for a clean benchmark'; import logxide; print('logxide', logxide.__version__)"
56
+ - name: Benchmark A — native FileHandler vs stdlib (perf_vs_stdlib)
57
+ run: uv run python benchmark/perf_vs_stdlib.py
58
+ - name: Benchmark B — durable cross-library sink (basic_handlers)
59
+ run: uv run python benchmark/basic_handlers_benchmark.py -n 20000
60
+ - name: Upload benchmark JSON artifacts
61
+ if: always()
62
+ uses: actions/upload-artifact@v4
63
+ with:
64
+ name: benchmark-results-py${{ matrix.python-version }}
65
+ path: |
66
+ benchmark/perf_results/
67
+ basic_handlers_benchmark_*.json
68
+ if-no-files-found: ignore
@@ -7,6 +7,71 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.2.2] - 2026-07-14
11
+
12
+ ### Performance
13
+ - **Skip `str()` coercion when the log message is already a `str` (M3).** The hot
14
+ path previously called `PyObject_Str` on every `logger.info(...)` even when the
15
+ message was already a `str`; it now reads the UTF-8 directly for exact-`str`
16
+ messages (guarded by an exact-type check so `str` subclasses and non-`str`
17
+ objects still coerce via `str()` exactly as before).
18
+ - **Per-second `asctime` cache (M4).** For the default date format
19
+ (`%Y-%m-%d %H:%M:%S`, no sub-second field), the formatted timestamp prefix is
20
+ cached per thread per epoch-second — byte-identical output, but avoids
21
+ re-running the chrono local-time conversion on every record. Custom `datefmt`
22
+ (which may contain `%f`) is never cached and takes the exact original path.
23
+ - Least-noisy microbench scenarios improved with no regression anywhere
24
+ (structured ~216K→~307K rec/s, `%`-args ~142K→~204K rec/s on the reference
25
+ machine; machine-specific).
26
+ - **Deferred (M2):** a Rust-native caller-frame walk was evaluated and NOT done —
27
+ low payoff now that caller-info is rarely enabled (post-0.2.1), and `PyFrame`/
28
+ `f_lineno` C-API internals differ across CPython 3.12/3.13/3.14 (correctness
29
+ risk). `populate_caller_info` is unchanged.
30
+
31
+ ### Documentation
32
+ - **Corrected the "drop-in replacement" overstatement.** README, the package
33
+ description, `logxide/__init__.py`, docs, and the blog drafts no longer claim a
34
+ flat "drop-in replacement for Python's logging"; they now say **near-drop-in for
35
+ common patterns** and link the compatibility notes documenting the differences
36
+ (flush drains/waits, no `LogRecord`/`Logger` subclassing, custom `Formatter`
37
+ subclasses fall back to a slower path, changed async-overflow default).
38
+ - Blog drafts: replaced the debunked `13.21×` / `1.9M rec/s` single-machine table
39
+ with honest sink-verified ranges and the 3.12≈3.14 parity note.
40
+
41
+ ### CI
42
+ - Added `.github/workflows/benchmark.yml` — a manual/weekly, environment-matched
43
+ (clean, no `sentry-sdk`) benchmark run across Python 3.12 and 3.14 that uploads
44
+ sink-verified results as artifacts, so the published numbers are reproducible
45
+ rather than single-machine.
46
+
47
+ ## [0.2.1] - 2026-07-14
48
+
49
+ ### Fixed
50
+ - **Merely installing `sentry-sdk` no longer taxes every log call (~20%) — completes
51
+ the P1-1 fix.** In 0.2.0, importing `sentry-sdk` (even with no DSN / no active
52
+ client) pulled in `urllib3`, which registers a formatter-less
53
+ `logging.NullHandler`. That handler hit 0.2.0's "conservative default = require
54
+ caller-info when a foreign handler's formatter is not inspectable", flipping the
55
+ process-global caller-frame flag on and running `sys._getframe().f_lineno` on
56
+ every record. Root-caused by comparative profiling (the frame lookup was
57
+ ~22–35% of hot-path CPU on CPython 3.14).
58
+ - Foreign handlers now force caller-info **only** when their formatter demonstrably
59
+ references a caller field (`%(pathname)s` / `%(filename)s` / `%(module)s` /
60
+ `%(lineno)s` / `%(funcName)s`); a formatter-less or non-inspectable handler no
61
+ longer forces it (performance-safe default).
62
+ - A **configured** Sentry handler still activates caller-info explicitly (it
63
+ forwards caller frames to Sentry), and formatters that genuinely use caller
64
+ fields still populate `pathname`/`lineno`/`funcName` as before.
65
+ - This also corrects a benchmarking pitfall: a 3.12-vs-3.14 comparison run with
66
+ `sentry-sdk` present in only one environment showed a spurious ~20% "3.14
67
+ regression". Environment-matched, CPython 3.12 and 3.14 throughput are at
68
+ parity; there is no intrinsic 3.14 regression.
69
+
70
+ ### Notes
71
+ - No API or wire-format changes. Behavior change is limited to when caller-frame
72
+ introspection is auto-enabled. 345 tests pass (343 + a new caller-info-scope
73
+ regression test).
74
+
10
75
  ## [0.2.0] - 2026-07-13
11
76
 
12
77
  This release resolves the correctness and performance defects found in the
@@ -53,6 +118,11 @@ the BREAKING section before upgrading.
53
118
  handlers/formatters actually in use and is recomputed when handlers are removed,
54
119
  instead of a one-way global flag. This removes the ~2.1x per-log penalty observed
55
120
  when `sentry-sdk` was merely importable.
121
+ - **Correction (see 0.2.1):** this fix was **incomplete** in 0.2.0. Importing
122
+ `sentry-sdk` pulls in `urllib3`, which registers a formatter-less
123
+ `logging.NullHandler`; 0.2.0's "conservative default" still forced caller-info
124
+ for such handlers, so the ~20% tax persisted whenever `sentry-sdk` was installed.
125
+ Fully fixed in 0.2.1.
56
126
 
57
127
  ### Performance
58
128
  - **Enabled logs with no destination do far less work (P1-2).** The Python
@@ -709,7 +709,7 @@ checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
709
709
 
710
710
  [[package]]
711
711
  name = "logxide"
712
- version = "0.2.0"
712
+ version = "0.2.2"
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.0"
3
+ version = "0.2.2"
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.0
3
+ Version: 0.2.2
4
4
  Classifier: Development Status :: 4 - Beta
5
5
  Classifier: Intended Audience :: Developers
6
6
  Classifier: License :: OSI Approved :: MIT License
@@ -36,7 +36,7 @@ Requires-Dist: sentry-sdk>=1.40.0 ; extra == 'sentry'
36
36
  Provides-Extra: dev
37
37
  Provides-Extra: sentry
38
38
  License-File: LICENSE
39
- Summary: Fastest Python logging library — Rust-powered, stdlib-compatible API
39
+ Summary: High-performance Python logging — Rust-powered, stdlib-compatible API
40
40
  Keywords: logging,rust,performance,fast-logging,python-logging,high-performance,thread-safe,sentry,opentelemetry
41
41
  Author-email: Indosaram <freedomzero91@gmail.com>
42
42
  Maintainer-email: Indosaram <freedomzero91@gmail.com>
@@ -52,9 +52,9 @@ Project-URL: Source Code, https://github.com/Indosaram/logxide
52
52
 
53
53
  # LogXide
54
54
 
55
- **Up to 13× faster Python logging, powered by Rust.**
55
+ **Several-fold faster than stdlib logging (roughly 5–11× on file logging, scenario- and machine-dependent), sink-verified. Powered by Rust.**
56
56
 
57
- Same stdlib API. Same `getLogger`. Same format strings. Just faster.
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
60
  # Before # After
@@ -62,7 +62,7 @@ import logging from logxide import logging
62
62
 
63
63
  logging.basicConfig(level=logging.INFO)
64
64
  logger = logging.getLogger('myapp')
65
- logger.info('Hello, world!') # Up to 13× faster. Same code.
65
+ logger.info('Hello, world!') # Common patterns: same code, several-fold faster.
66
66
  ```
67
67
 
68
68
  [![PyPI](https://img.shields.io/pypi/v/logxide)](https://pypi.org/project/logxide/)
@@ -85,31 +85,33 @@ pip install logxide[sentry]
85
85
 
86
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.
87
87
 
88
- ### Cross-library durable throughput (sink-verified)
88
+ ### Benchmarks
89
89
 
90
- Measured with `benchmark/basic_handlers_benchmark.py` on macOS M4 Max, CPython 3.14.2, release build, `-n 20000`, each library in its own subprocess. **Durable** = records the sink actually confirmed after flush (every row verified at 20,200 / 20,200), not records merely enqueued. Numbers are machine-specific and rounded:
90
+ Two sink-verified benchmarks, both re-run this session on **macOS M4 Max, release build**, across **Python 3.12.11 and 3.14.2**. *Sink-verified durable throughput* means records the sink actually confirmed after `flush()`, not records merely enqueued. Numbers are machine-specific and rounded to ranges; baselines are noisy run-to-run (roughly ±40%), so treat the ranges as the signal, not any single figure. **CPython 3.12 and 3.14 come out at parity** once the test environments match, so the ranges below apply to both.
91
91
 
92
- | Sink | LogXide durable rec/s | stdlib | LogXide vs stdlib |
93
- | :---------- | ---------------------: | --------: | :---------------- |
94
- | FILE | ~739K–960K | 74,605 | **~10×** |
95
- | STREAM | ~273K | 53,292 | **~5×** |
96
- | ROTATING | ~202K | 42,981 | **~4.7×** |
92
+ **Benchmark A — native `FileHandler` vs stdlib.** `benchmark/perf_vs_stdlib.py`, LogXide and stdlib each measured in isolation. `FileHandler` is synchronous, so these are durable (no async drops). Rounded speedup vs stdlib, comparable on Python 3.12 and 3.14:
97
93
 
98
- LogXide leads every sink. On STREAM, Structlog is the runner-up (~117K rec/s, ~2.2× stdlib) but still well behind LogXide. Full tables, per-library p50 latencies, and async delivery accounting are in [docs/benchmarks.md](docs/benchmarks.md#comparative-benchmark--all-logging-libraries-corrected-sink-verified).
94
+ | Scenario | Speedup vs stdlib |
95
+ | :--------- | :---------------- |
96
+ | simple | **~7–9×** |
97
+ | structured | **~7–9×** |
98
+ | `%`-args | **~5–6×** |
99
99
 
100
- ### vs stdlib, single-format FileHandler (subprocess-isolated)
100
+ **Benchmark B — durable cross-library sink.** `benchmark/basic_handlers_benchmark.py`, each library in its own subprocess, sink-verified 20,200 / 20,200. Rounded speedup vs stdlib, comparable across Python 3.12 and 3.14:
101
101
 
102
- FileHandler benchmark, Python 3.12, 100K iterations, format `"%(asctime)s - %(name)s - %(levelname)s - %(message)s"`, LogXide vs stdlib with stdlib in a subprocess for fair isolation. `FileHandler` is synchronous, so these are durable numbers (no async drops). Figures are machine-specific:
102
+ | Sink | Speedup vs stdlib |
103
+ | :------- | :------------------------ |
104
+ | FILE | **~6–11×** |
105
+ | ROTATING | **~8–14×** |
106
+ | STREAM | **~5×** (async, see note) |
103
107
 
104
- | Scenario | LogXide | stdlib | Speedup |
105
- | :-------------------- | --------: | ------: | :---------- |
106
- | Simple | 1,922,911 | 145,562 | **13.21×** |
107
- | Structured (f-string) | 1,612,029 | 144,328 | **11.17×** |
108
- | With `%s` args | 976,572 | 144,156 | **6.77×** |
108
+ > **STREAM is asynchronous.** It reaches ~5× when its queue fully drains, but under a sustained max-rate burst the bounded queue can drop records (one loaded run delivered ~14,420 / 20,200; an idle machine delivered 20,200 / 20,200). Treat STREAM as fast best-effort delivery: call `flush()` and check `get_metrics()` to confirm what landed, rather than as a guaranteed durable multiplier.
109
109
 
110
- > **Python 3.14**: LogXide is also faster (4.25–7.23× vs stdlib), though the absolute gap narrows because stdlib's per-iteration overhead is lower under 3.14. See [docs/benchmarks.md](docs/benchmarks.md#python-314) for the full Python 3.14 table.
110
+ Async HTTP delivery is accounted honestly on both versions: `http_block` lands 20,000 / 20,000 (durable), while `http_drop_newest` delivers ~260 / 20,000 and drops the rest, with `emitted == sink_acknowledged + queue_dropped + delivery_failed` holding throughout.
111
111
 
112
- For per-handler latency, async accounting, internal optimization wave breakdown, and historical comparison data, see [docs/benchmarks.md](docs/benchmarks.md).
112
+ > A prior draft reported a "Python 3.14 regression" (roughly half the file-path speedup on 3.14). That was a measurement artifact, not a real regression: the 3.14 test environment had `sentry-sdk` installed while the 3.12 one did not, and importing it pulled in a formatter-less `NullHandler` that forced process-global caller-frame collection on every log (a ~20% tax that only hit the 3.14 runs). This is fixed in 0.2.1; environment-matched, the two versions are at parity.
113
+
114
+ For full per-handler p50/p99 latency, cross-library detail, and async accounting, see [docs/benchmarks.md](docs/benchmarks.md).
113
115
 
114
116
  ## Works With
115
117
 
@@ -147,7 +149,7 @@ logger.error("This is automatically sent to Sentry")
147
149
  - WARNING+ sent as events, INFO as breadcrumbs
148
150
  - Full stack traces and custom context
149
151
 
150
- An installed-but-unconfigured Sentry SDK does not attach a handler, and (as of 0.2.0) importing it no longer forces process-global caller-frame collection onto unrelated handlers.
152
+ An installed-but-unconfigured Sentry SDK does not attach a handler, and (as of 0.2.1) importing it no longer forces process-global caller-frame collection onto unrelated handlers.
151
153
 
152
154
  ## Native OpenTelemetry Support
153
155
 
@@ -1,8 +1,8 @@
1
1
  # LogXide
2
2
 
3
- **Up to 13× faster Python logging, powered by Rust.**
3
+ **Several-fold faster than stdlib logging (roughly 5–11× on file logging, scenario- and machine-dependent), sink-verified. Powered by Rust.**
4
4
 
5
- Same stdlib API. Same `getLogger`. Same format strings. Just faster.
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
8
  # Before # After
@@ -10,7 +10,7 @@ import logging from logxide import logging
10
10
 
11
11
  logging.basicConfig(level=logging.INFO)
12
12
  logger = logging.getLogger('myapp')
13
- logger.info('Hello, world!') # Up to 13× faster. Same code.
13
+ logger.info('Hello, world!') # Common patterns: same code, several-fold faster.
14
14
  ```
15
15
 
16
16
  [![PyPI](https://img.shields.io/pypi/v/logxide)](https://pypi.org/project/logxide/)
@@ -33,31 +33,33 @@ pip install logxide[sentry]
33
33
 
34
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.
35
35
 
36
- ### Cross-library durable throughput (sink-verified)
36
+ ### Benchmarks
37
37
 
38
- Measured with `benchmark/basic_handlers_benchmark.py` on macOS M4 Max, CPython 3.14.2, release build, `-n 20000`, each library in its own subprocess. **Durable** = records the sink actually confirmed after flush (every row verified at 20,200 / 20,200), not records merely enqueued. Numbers are machine-specific and rounded:
38
+ Two sink-verified benchmarks, both re-run this session on **macOS M4 Max, release build**, across **Python 3.12.11 and 3.14.2**. *Sink-verified durable throughput* means records the sink actually confirmed after `flush()`, not records merely enqueued. Numbers are machine-specific and rounded to ranges; baselines are noisy run-to-run (roughly ±40%), so treat the ranges as the signal, not any single figure. **CPython 3.12 and 3.14 come out at parity** once the test environments match, so the ranges below apply to both.
39
39
 
40
- | Sink | LogXide durable rec/s | stdlib | LogXide vs stdlib |
41
- | :---------- | ---------------------: | --------: | :---------------- |
42
- | FILE | ~739K–960K | 74,605 | **~10×** |
43
- | STREAM | ~273K | 53,292 | **~5×** |
44
- | ROTATING | ~202K | 42,981 | **~4.7×** |
40
+ **Benchmark A — native `FileHandler` vs stdlib.** `benchmark/perf_vs_stdlib.py`, LogXide and stdlib each measured in isolation. `FileHandler` is synchronous, so these are durable (no async drops). Rounded speedup vs stdlib, comparable on Python 3.12 and 3.14:
45
41
 
46
- LogXide leads every sink. On STREAM, Structlog is the runner-up (~117K rec/s, ~2.2× stdlib) but still well behind LogXide. Full tables, per-library p50 latencies, and async delivery accounting are in [docs/benchmarks.md](docs/benchmarks.md#comparative-benchmark--all-logging-libraries-corrected-sink-verified).
42
+ | Scenario | Speedup vs stdlib |
43
+ | :--------- | :---------------- |
44
+ | simple | **~7–9×** |
45
+ | structured | **~7–9×** |
46
+ | `%`-args | **~5–6×** |
47
47
 
48
- ### vs stdlib, single-format FileHandler (subprocess-isolated)
48
+ **Benchmark B — durable cross-library sink.** `benchmark/basic_handlers_benchmark.py`, each library in its own subprocess, sink-verified 20,200 / 20,200. Rounded speedup vs stdlib, comparable across Python 3.12 and 3.14:
49
49
 
50
- FileHandler benchmark, Python 3.12, 100K iterations, format `"%(asctime)s - %(name)s - %(levelname)s - %(message)s"`, LogXide vs stdlib with stdlib in a subprocess for fair isolation. `FileHandler` is synchronous, so these are durable numbers (no async drops). Figures are machine-specific:
50
+ | Sink | Speedup vs stdlib |
51
+ | :------- | :------------------------ |
52
+ | FILE | **~6–11×** |
53
+ | ROTATING | **~8–14×** |
54
+ | STREAM | **~5×** (async, see note) |
51
55
 
52
- | Scenario | LogXide | stdlib | Speedup |
53
- | :-------------------- | --------: | ------: | :---------- |
54
- | Simple | 1,922,911 | 145,562 | **13.21×** |
55
- | Structured (f-string) | 1,612,029 | 144,328 | **11.17×** |
56
- | With `%s` args | 976,572 | 144,156 | **6.77×** |
56
+ > **STREAM is asynchronous.** It reaches ~5× when its queue fully drains, but under a sustained max-rate burst the bounded queue can drop records (one loaded run delivered ~14,420 / 20,200; an idle machine delivered 20,200 / 20,200). Treat STREAM as fast best-effort delivery: call `flush()` and check `get_metrics()` to confirm what landed, rather than as a guaranteed durable multiplier.
57
57
 
58
- > **Python 3.14**: LogXide is also faster (4.25–7.23× vs stdlib), though the absolute gap narrows because stdlib's per-iteration overhead is lower under 3.14. See [docs/benchmarks.md](docs/benchmarks.md#python-314) for the full Python 3.14 table.
58
+ Async HTTP delivery is accounted honestly on both versions: `http_block` lands 20,000 / 20,000 (durable), while `http_drop_newest` delivers ~260 / 20,000 and drops the rest, with `emitted == sink_acknowledged + queue_dropped + delivery_failed` holding throughout.
59
59
 
60
- For per-handler latency, async accounting, internal optimization wave breakdown, and historical comparison data, see [docs/benchmarks.md](docs/benchmarks.md).
60
+ > A prior draft reported a "Python 3.14 regression" (roughly half the file-path speedup on 3.14). That was a measurement artifact, not a real regression: the 3.14 test environment had `sentry-sdk` installed while the 3.12 one did not, and importing it pulled in a formatter-less `NullHandler` that forced process-global caller-frame collection on every log (a ~20% tax that only hit the 3.14 runs). This is fixed in 0.2.1; environment-matched, the two versions are at parity.
61
+
62
+ For full per-handler p50/p99 latency, cross-library detail, and async accounting, see [docs/benchmarks.md](docs/benchmarks.md).
61
63
 
62
64
  ## Works With
63
65
 
@@ -95,7 +97,7 @@ logger.error("This is automatically sent to Sentry")
95
97
  - WARNING+ sent as events, INFO as breadcrumbs
96
98
  - Full stack traces and custom context
97
99
 
98
- An installed-but-unconfigured Sentry SDK does not attach a handler, and (as of 0.2.0) importing it no longer forces process-global caller-frame collection onto unrelated handlers.
100
+ An installed-but-unconfigured Sentry SDK does not attach a handler, and (as of 0.2.1) importing it no longer forces process-global caller-frame collection onto unrelated handlers.
99
101
 
100
102
  ## Native OpenTelemetry Support
101
103
 
@@ -5,7 +5,7 @@ This document provides comprehensive performance analysis of LogXide compared to
5
5
  ## Test Environment
6
6
 
7
7
  - **Platform**: macOS ARM64 (Apple Silicon)
8
- - **Python**: 3.12.12 / 3.14.2
8
+ - **Python**: 3.12.11 / 3.14.2
9
9
  - **Test Methodology**: Multiple runs (3 iterations) with averages, garbage collection between tests
10
10
  - **Libraries Tested**: LogXide, Picologging, Structlog
11
11
  - **Test Date**: December 30, 2024 (external), March 19, 2026 (internal), June 12, 2026 (Unreleased)
@@ -26,13 +26,7 @@ The next release introduces a series of hot-path optimizations measured against
26
26
 
27
27
  ### vs Python stdlib `logging`
28
28
 
29
- Methodology: `benchmark/perf_vs_stdlib.py`, 100K iterations × 3 runs, FileHandler. stdlib runs in a subprocess to avoid LogXide's interceptor overriding `logging.Logger`.
30
-
31
- | Scenario | LogXide | stdlib | Speedup |
32
- | :--------- | ----------: | ---------: | :--------- |
33
- | simple | 1,228,811 | 182,533 | **6.73×** |
34
- | structured | 1,064,164 | 177,366 | **6.00×** |
35
- | args | 750,129 | 176,633 | **4.25×** |
29
+ The head-to-head speedup vs stdlib for this build is reported once, for both Python versions, in the canonical **Benchmark A** section below ("File I/O Scenarios — vs stdlib"). It lands at roughly ~7–9× on the simple / structured scenarios and ~5–6× on `%`-args, comparable on Python 3.12 and 3.14.
36
30
 
37
31
  ### Optimization Wave Breakdown
38
32
 
@@ -96,39 +90,35 @@ The defective cross-library harness flagged in the [performance audit](performan
96
90
  - uses a genuine `RotatingFileHandler` for the rotating row instead of substituting a plain `StreamHandler`.
97
91
 
98
92
  !!! note "These numbers are machine-specific"
99
- Measured on **macOS M4 Max, CPython 3.14.2, release build, `-n 20000`**, per-scenario subprocess isolation. Absolute throughput depends on the machine, the build, and the sink. Treat the multipliers ("~10×", "~5×") as the durable signal and the raw rec/s as a rounded, run-specific reading. Run-to-run variance is real: the FILE durable figure was observed anywhere from ~740K to ~960K rec/s across repeated runs, so figures here are rounded rather than presented to false precision. Reproduce with `benchmark/basic_handlers_benchmark.py`.
93
+ Re-run this session on **macOS M4 Max, release build, `-n 20000`**, per-scenario subprocess isolation, on **both CPython 3.12.11 and 3.14.2**. Absolute throughput depends on the machine, the build, and the sink. Treat the rounded ranges (FILE ~6–11×, ROTATING ~8–14×, STREAM ~5×) as the durable signal, not any single raw rec/s. Run-to-run variance is real (roughly ±40% on these baselines), so figures here are presented as ranges rather than to false precision, and CPython 3.12 and 3.14 land at parity. Reproduce with `benchmark/basic_handlers_benchmark.py`.
100
94
 
101
- ### FILE — durable throughput (synchronous file sink)
95
+ !!! note "A prior '3.14 regression' was an environment artifact"
96
+ An earlier draft published a per-version table showing the file path at roughly half the speedup on Python 3.14. That was a measurement artifact, not a real regression: the 3.14 test venv had `sentry-sdk` installed while the 3.12 venv did not, and importing `sentry-sdk` pulled in `urllib3`'s formatter-less `NullHandler`, which forced process-global caller-frame collection on every log (a ~20% tax that only hit the 3.14 runs). This is fixed in 0.2.1. Environment-matched, CPython 3.12 and 3.14 are at parity, so the ranges here apply to both versions.
102
97
 
103
- | Library | Durable rec/s | p50 latency | vs stdlib |
104
- | :------------- | ------------: | ----------: | :-------- |
105
- | **LogXide** | **739,332** | 833 ns | **~10×** |
106
- | Python logging | 74,605 | 6,167 ns | 1.0× (baseline) |
107
- | Loguru | 57,511 | 8,500 ns | 0.77× |
108
- | Structlog | 41,364 | 5,583 ns | 0.55× |
98
+ ### Benchmark B — LogXide vs stdlib durable throughput (both Python versions)
109
99
 
110
- LogXide lands around **~10× stdlib** on the durable file path. Observed range across runs: ~740K–960K rec/s.
100
+ Re-run this session on both Python 3.12.11 and 3.14.2, sink-verified 20,200 / 20,200. Durable speedup vs stdlib, rounded to ranges and comparable across the two versions:
111
101
 
112
- ### STREAM — durable throughput
102
+ | Sink | Speedup vs stdlib |
103
+ | :------- | :------------------------ |
104
+ | FILE | **~6–11×** |
105
+ | ROTATING | **~8–14×** |
106
+ | STREAM | **~5×** (async — see note) |
113
107
 
114
- | Library | Durable rec/s | p50 latency | vs stdlib |
115
- | :------------- | ------------: | ----------: | :-------- |
116
- | **LogXide** | **272,829** | 917 ns | **~5×** |
117
- | Structlog | 116,796 | 5,208 ns | 2.2× |
118
- | Python logging | 53,292 | 6,334 ns | 1.0× (baseline) |
119
- | Loguru | 52,508 | 8,459 ns | 0.99× |
108
+ !!! warning "STREAM is asynchronous, not a guaranteed durable multiplier"
109
+ LogXide's stream handler hands records to a background worker. It reaches ~5× stdlib when the queue fully drains (20,200 / 20,200 on an idle machine), but under a sustained max-rate emit burst its bounded queue can drop records — one loaded run delivered only ~14,420 / 20,200. Call `flush()` and inspect `get_metrics()` to confirm delivery; do not read STREAM as a durable multiplier the way FILE and ROTATING are.
120
110
 
121
- Structlog beats stdlib on the stream sink here (about 2.2×), but LogXide still leads all libraries at **~5× stdlib**.
111
+ ### Cross-library runner-up snapshot
122
112
 
123
- ### ROTATING — durable throughput (real `RotatingFileHandler`)
113
+ Among the other libraries that install on Python 3.13+ (stdlib, Loguru, Structlog), LogXide leads every sink. Durable throughput of the runner-ups on the reference machine (single cross-library run, rounded):
124
114
 
125
- | Library | Durable rec/s | p50 latency | vs stdlib |
126
- | :------------- | ------------: | ----------: | :-------- |
127
- | **LogXide** | **201,663** | 833 ns | **~4.7×** |
128
- | Python logging | 42,981 | 8,542 ns | 1.0× (baseline) |
129
- | Loguru | 33,095 | 9,666 ns | 0.77× |
115
+ | Library | FILE durable | STREAM durable | ROTATING durable |
116
+ | :------------- | -----------: | -------------: | ---------------: |
117
+ | Python logging | 74,605 | 53,292 | 42,981 |
118
+ | Structlog | 41,364 | 116,796 | — |
119
+ | Loguru | 57,511 | 52,508 | 33,095 |
130
120
 
131
- Picologging is not included in the corrected runs (it does not install on Python 3.13+), so no cross-library number is asserted against it; see [comparison-picologging.md](comparison-picologging.md) for the qualitative discussion.
121
+ Structlog is the notable exception on the **stream** sink, where it beats stdlib at ~2.2× (116,796 vs 53,292 rec/s) and outruns Loguru — but LogXide still leads it there (~5× stdlib). On FILE and ROTATING, Structlog and Loguru both trail stdlib. Picologging is excluded from the corrected runs (it does not install on Python 3.13+, and the benchmark machine runs CPython 3.14.2), so no cross-library multiplier is asserted against it; see [comparison-picologging.md](comparison-picologging.md) for the qualitative discussion.
132
122
 
133
123
  ### Async accounting — durable vs lossy producers
134
124
 
@@ -137,9 +127,9 @@ Async handlers are only meaningful if "throughput" means records the sink confir
137
127
  | Scenario | emitted | sink_acknowledged | queue_dropped | Producer behavior |
138
128
  | :----------------- | ------: | ----------------: | ------------: | :--------------------------- |
139
129
  | `http_block` | 20,000 | 20,000 | 0 | durable, producer p99 ~3 ms |
140
- | `http_drop_newest` | 20,000 | 262 | 19,738 | instant producer, lossy |
130
+ | `http_drop_newest` | 20,000 | 260 | 19,740 | instant producer, lossy |
141
131
 
142
- `http_block` back-pressures the producer (slower calls, but every record lands). `http_drop_newest` returns instantly and drops under saturation, so its "producer throughput" would look enormous while only 262 records actually reached the sink. This is exactly the trap the old harness fell into; `get_metrics()` makes the distinction explicit.
132
+ `http_block` back-pressures the producer (slower calls, but every record lands). `http_drop_newest` returns instantly and drops under saturation, so its "producer throughput" would look enormous while only 260 records actually reached the sink. This is exactly the trap the old harness fell into; `get_metrics()` makes the distinction explicit.
143
133
 
144
134
  ### Micro benchmarks (LogXide native path, sink-verified)
145
135
 
@@ -162,32 +152,28 @@ Regardless of the exact numbers, LogXide's design has real, qualitative advantag
162
152
  2. **Background async I/O**: stream/HTTP/OTLP handlers hand records to a worker thread instead of blocking the caller on the sink.
163
153
  3. **Explicit async accounting**: `get_metrics()` reports `emitted`, `sink_acknowledged`, `queue_dropped`, `delivery_failed`, and `in_flight`, so "throughput" always means records the sink confirmed — never records that were merely enqueued.
164
154
 
165
- The corrected harness quantifies these advantages honestly: on this machine they show up as roughly ~10× stdlib on the file path, ~5× on stream, and ~4.7× on rotating (durable, sink-verified), rather than the inflated multipliers the old harness produced.
155
+ The corrected harness quantifies these advantages honestly: on this machine they show up as roughly ~6–11× stdlib on the file path and ~8–14× on rotating, plus ~5× on the async stream sink when it fully drains (durable, sink-verified), comparable on Python 3.12 and 3.14, rather than the inflated multipliers the old harness produced.
166
156
 
167
157
  ## File I/O Scenarios — vs stdlib `logging` (subprocess-isolated)
168
158
 
169
- Methodology: `benchmark/perf_vs_stdlib.py`, 100,000 iterations × 3 runs, FileHandler with the same standard format. stdlib runs in a subprocess so LogXide's import-time module override doesn't pollute the measurement.
159
+ This is **Benchmark A**. Methodology: `benchmark/perf_vs_stdlib.py`, 50,000 iterations, FileHandler with the standard format `"%(asctime)s - %(name)s - %(levelname)s - %(message)s"`. LogXide and stdlib are each measured in isolation (stdlib in its own process so LogXide's import-time module override doesn't pollute the measurement). Re-run this session on macOS M4 Max, release build, on both Python 3.12.11 and 3.14.2.
170
160
 
171
161
  !!! note "Scope of these numbers"
172
- These compare only LogXide against stdlib, each in its own process — the subprocess isolation the [audit](performance-bottleneck-report-2026-07-13.md) (§5) recommends. `FileHandler` is a **synchronous** Rust handler, so there is no async queue and "durable throughput" equals producer throughput here; no records are dropped. The figures are still specific to the machine and build below, and they measure a single format-string scenario. The corrected, sink-verified cross-library and async-handler numbers are published in the [comparative section above](#comparative-benchmark--all-logging-libraries-corrected-sink-verified).
162
+ These compare only LogXide against stdlib, each in its own process — the subprocess isolation the [audit](performance-bottleneck-report-2026-07-13.md) (§5) recommends. `FileHandler` is a **synchronous** Rust handler, so there is no async queue and "durable throughput" equals producer throughput here; no records are dropped. The figures are machine-specific and rounded to ranges (baselines are noisy run-to-run, roughly ±40%), and they measure the standard format-string scenarios. The corrected, sink-verified cross-library and async-handler numbers are published in the [comparative section above](#comparative-benchmark--all-logging-libraries-corrected-sink-verified).
173
163
 
174
- ### Python 3.12
164
+ ### Speedup vs stdlib (comparable on both Python versions)
175
165
 
176
- | Scenario | stdlib `logging` | LogXide | Speedup |
177
- | :--------- | ---------------: | ----------: | :------------ |
178
- | simple | 145,562 | **1,922,911** | **13.21× faster** |
179
- | structured | 144,328 | **1,612,029** | **11.17× faster** |
180
- | with `%s` args | 144,156 | **976,572** | **6.77× faster** |
166
+ Rounded speedup vs stdlib. CPython 3.12 and 3.14 land at parity once the environments match, so a single range covers both:
181
167
 
182
- ### Python 3.14
168
+ | Scenario | Speedup vs stdlib |
169
+ | :--------- | :---------------- |
170
+ | simple | **~7–9×** |
171
+ | structured | **~7–9×** |
172
+ | `%`-args | **~5–6×** |
183
173
 
184
- | Scenario | stdlib `logging` | LogXide | Speedup |
185
- | :--------- | ---------------: | ----------: | :------------ |
186
- | simple | 182,533 | **1,228,811** | **6.73× faster** |
187
- | structured | 177,366 | **1,064,164** | **6.00× faster** |
188
- | with `%s` args | 176,633 | **750,129** | **4.25× faster** |
174
+ For reference, LogXide absolute throughput lands around 1.0–1.4M rec/s on the simple and structured scenarios and ~0.8–0.9M rec/s on `%`-args, while stdlib sits around 0.12–0.17M rec/s; exact rec/s swings run-to-run, which is why the table reports ranges.
189
175
 
190
- LogXide is faster on both versions; stdlib's per-iteration overhead dropped on 3.14, narrowing the absolute gap. The Python 3.12 simple-logging scenario remains the best-case headline figure.
176
+ LogXide is faster on both versions. There is no intrinsic Python 3.14 regression: an earlier draft that showed 3.14 at roughly half the file-path speedup was measuring a `sentry-sdk` environment artifact (see the note in the comparative section), fixed in 0.2.1. Every figure is machine-specific and rounded.
191
177
 
192
178
  ### Why LogXide is faster
193
179
 
@@ -240,7 +226,7 @@ LogXide is faster on both versions; stdlib's per-iteration overhead dropped on 3
240
226
  **1. Real I/O Operations**
241
227
  - Runs actual file writes through Rust's native `BufWriter` rather than synthetic no-ops
242
228
  - Efficient buffering and system call optimization
243
- - Cross-library durable throughput is now sink-verified: ~10× stdlib on file, ~5× on stream, ~4.7× on rotating (see the [corrected comparative section](#comparative-benchmark--all-logging-libraries-corrected-sink-verified)); Picologging is excluded because it does not install on Python 3.13+
229
+ - Cross-library durable throughput is now sink-verified: on the file path LogXide is ~6–11× stdlib, ~8–14× on rotating, and ~5× on the async stream sink (comparable on Python 3.12 and 3.14; see the [corrected comparative section](#comparative-benchmark--all-logging-libraries-corrected-sink-verified)); Picologging is excluded because it does not install on Python 3.13+
244
230
 
245
231
  **2. Consistent Performance**
246
232
  - Maintains advantage across all logging patterns
@@ -257,7 +243,7 @@ LogXide is faster on both versions; stdlib's per-iteration overhead dropped on 3
257
243
  **Choose LogXide when:**
258
244
  - You need maximum performance in production
259
245
  - Your application does significant logging to files
260
- - You want a drop-in replacement with better performance
246
+ - You want a near-drop-in (common patterns) with better performance
261
247
  - You value consistent performance across scenarios
262
248
 
263
249
  **Choose Picologging when:**
@@ -314,19 +300,19 @@ python benchmark/compare_loggers.py
314
300
 
315
301
  **LogXide is the best choice for production Python applications:**
316
302
 
317
- 1. **Strong file-I/O performance**: Against stdlib in the subprocess-isolated, synchronous-`FileHandler` scenario, LogXide is substantially faster. The corrected, sink-verified harness puts LogXide at ~10× stdlib on the durable file path, ~5× on stream, and ~4.7× on rotating; exact multipliers are machine- and scenario-specific.
303
+ 1. **Strong file-I/O performance**: Against stdlib in the subprocess-isolated, synchronous-`FileHandler` scenario, LogXide is substantially faster. The corrected, sink-verified harness puts LogXide at ~6–11× stdlib on the durable file path and ~8–14× on rotating, plus ~5× on the async stream sink when it fully drains; exact multipliers are machine- and scenario-specific, and Python 3.12 and 3.14 are at parity.
318
304
  2. **Real-World Testing**: Benchmarks based on actual file operations, not synthetic tests
319
- 3. **Drop-in Replacement**: No code changes required for common patterns
305
+ 3. **Near-drop-in**: minimal/no code changes for common patterns (some advanced stdlib scenarios differ — see [compatibility](compatibility.md))
320
306
  4. **Native Performance**: Rust's efficiency provides measurable benefits
321
307
 
322
308
  ### Performance Summary Table (durable, sink-verified)
323
309
 
324
- The old per-library summary that reranked everything from the defective harness has been replaced by the corrected, sink-verified [comparative tables above](#comparative-benchmark--all-logging-libraries-corrected-sink-verified). On the reference machine (macOS M4 Max, CPython 3.14.2), the durable headline is: LogXide leads every sink, at roughly ~10× stdlib on file, ~5× on stream, and ~4.7× on rotating. Structlog is the runner-up on stream (~2.2× stdlib). Every figure is machine-specific and rounded to avoid false precision.
310
+ The old per-library summary that reranked everything from the defective harness has been replaced by the corrected, sink-verified [comparative tables above](#comparative-benchmark--all-logging-libraries-corrected-sink-verified). On the reference machine (macOS M4 Max), re-run this session on both Python 3.12.11 and 3.14.2, the durable headline is: LogXide leads every sink, at roughly ~6–11× stdlib on file and ~8–14× on rotating, plus ~5× on the async stream sink. The two Python versions come out at parity. Structlog is the runner-up on stream (~2.2× stdlib). Every figure is machine-specific and rounded to ranges to avoid false precision.
325
311
 
326
312
  ### Key Takeaways
327
313
 
328
314
  1. **LogXide is designed for real-world file I/O**: the durable path writes through a Rust `BufWriter` with no Python `LogRecord` on the fast path
329
- 2. **Cross-library gaps are now sink-verified**: LogXide leads all measured libraries on durable throughput (~10× stdlib on file, ~5× on stream, ~4.7× on rotating); numbers are machine-specific and reproduced via `benchmark/basic_handlers_benchmark.py`
315
+ 2. **Cross-library gaps are now sink-verified**: LogXide leads all measured libraries on durable throughput (~6–11× stdlib on file, ~8–14× on rotating, ~5× on the async stream sink; comparable on Python 3.12 and 3.14); numbers are machine-specific and reproduced via `benchmark/basic_handlers_benchmark.py`
330
316
  3. **Rust advantage is architectural**: native code and background async I/O provide measurable benefits, quantified honestly by the corrected harness
331
317
  4. **Async delivery is accounted**: `get_metrics()` distinguishes delivered records from dropped ones, so async "throughput" is never inflated by drops
332
318
 
@@ -334,4 +320,4 @@ The old per-library summary that reranked everything from the defective harness
334
320
 
335
321
  ---
336
322
 
337
- *Benchmarks conducted on macOS ARM64 (Apple Silicon) with Python 3.12.0 (`pyenv`) and Python 3.14.2. Results may vary on different platforms but relative performance should be consistent.*
323
+ *Benchmarks conducted on macOS ARM64 (Apple Silicon) with Python 3.12.11 (`pyenv`) and Python 3.14.2. Results may vary on different platforms but relative performance should be consistent.*
@@ -6,7 +6,7 @@ Last month I was setting up Sentry for a FastAPI project. I'd done this fourteen
6
6
 
7
7
  Forty minutes later I had three packages installed, a 25-line config file, and Sentry breadcrumbs that still refused to appear. I stared at my screen and thought: this is stupid. This should take thirty seconds.
8
8
 
9
- That's why I built LogXide. It's a drop-in replacement for Python's stdlib logging, written in Rust. Same API. Same `getLogger`, same format strings. But up to 13× faster, and Sentry and OTLP just work. No handlers to configure. No JSON files to juggle.
9
+ That's why I built LogXide. It's a high-performance, largely stdlib-compatible logging library written in Rust — a near-drop-in for common patterns. Same `getLogger`, same format strings. Several-fold faster, and Sentry and OTLP just work. No handlers to configure. No JSON files to juggle. (It's not a strict drop-in — see the compatibility notes for the advanced patterns that differ.)
10
10
 
11
11
  ## The One-Line Migration
12
12
 
@@ -165,15 +165,15 @@ Sentry and OTLP work together. An error can trigger a Sentry event and ship to y
165
165
 
166
166
  ## Performance
167
167
 
168
- LogXide is up to 13× faster than stdlib logging:
168
+ LogXide is several-fold faster than stdlib logging — roughly 5–11× on file logging depending on the scenario. The numbers are sink-verified (records the sink actually confirmed after flush, not just enqueued), machine-specific, and comparable across Python 3.12 and 3.14, so treat them as ranges rather than a single figure:
169
169
 
170
- | Scenario | LogXide | stdlib | Speedup |
171
- | :--------- | --------: | ------: | --------: |
172
- | Simple msg | 1.92M ops/s | 146K ops/s | **13.21×** |
173
- | Structured | 1.61M ops/s | 144K ops/s | **11.17×** |
174
- | with `%s` args | 977K ops/s | 144K ops/s | **6.77×** |
170
+ | Scenario | vs stdlib (sink-verified) |
171
+ | :--------- | :------------------------ |
172
+ | Simple msg | ~7–9× |
173
+ | Structured | ~7–9× |
174
+ | with `%s` args | ~5–6× |
175
175
 
176
- It's also ~3× faster than Microsoft's picologging on the same Python version, which is written in C. Picologging exists and is good. LogXide is faster, runs on Python 3.13+, and has Sentry/OTLP built in.
176
+ It's also faster than Microsoft's picologging (written in C) on the same Python version, while additionally running on Python 3.13+/3.14 and having Sentry/OTLP built in. Picologging exists and is good; LogXide's edge is the extra reach and integrations.
177
177
 
178
178
  Full benchmarks with methodology are [on GitHub](https://github.com/Indosaram/logxide/blob/main/docs/benchmarks.md).
179
179
 
@@ -6,7 +6,7 @@ The test suite had been running for 47 seconds when it stopped. No error. No out
6
6
 
7
7
  I stared at the terminal. The cursor wasn't blinking. The progress bar had frozen mid-frame. I hit Ctrl+C. Nothing. I hit it again, harder, as if that would help. The process was deadlocked somewhere deep in the call stack, and I had no idea where.
8
8
 
9
- This was LogXide, my Rust-powered drop-in replacement for Python's logging module. I'd spent weeks making it up to 13× faster than stdlib. The benchmarks were beautiful. Then I merged to main, and everything caught fire.
9
+ This was LogXide, my Rust-powered, largely stdlib-compatible logging library. I'd spent weeks making it several-fold faster than stdlib. The benchmarks were beautiful. Then I merged to main, and everything caught fire.
10
10
 
11
11
  If you haven't read Part 1, it covers what LogXide actually does: you `pip install logxide`, replace `import logging` with `from logxide import logging`, and suddenly your log calls drop from ~6 microseconds to ~0.5 microseconds. Same API, same handlers, same everything — just Rust underneath. It works with Flask, Django, FastAPI, Sentry, OTLP. That's the happy path. This is the story of how I almost never got there.
12
12