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.
- logxide-0.2.2/.github/workflows/benchmark.yml +68 -0
- {logxide-0.2.0 → logxide-0.2.2}/CHANGELOG.md +70 -0
- {logxide-0.2.0 → logxide-0.2.2}/Cargo.lock +1 -1
- {logxide-0.2.0 → logxide-0.2.2}/Cargo.toml +1 -1
- {logxide-0.2.0 → logxide-0.2.2}/PKG-INFO +25 -23
- {logxide-0.2.0 → logxide-0.2.2}/README.md +23 -21
- {logxide-0.2.0 → logxide-0.2.2}/docs/benchmarks.md +43 -57
- {logxide-0.2.0 → logxide-0.2.2}/docs/blog-preview/part1.md +8 -8
- {logxide-0.2.0 → logxide-0.2.2}/docs/blog-preview/part2.md +1 -1
- {logxide-0.2.0 → logxide-0.2.2}/docs/comparison-picologging.md +1 -1
- {logxide-0.2.0 → logxide-0.2.2}/docs/comparison-stdlib.md +16 -16
- {logxide-0.2.0 → logxide-0.2.2}/docs/comparison-structlog.md +7 -7
- {logxide-0.2.0 → logxide-0.2.2}/docs/comparison.md +7 -7
- {logxide-0.2.0 → logxide-0.2.2}/docs/index.md +2 -2
- {logxide-0.2.0 → logxide-0.2.2}/docs/integrations/sentry.md +1 -1
- {logxide-0.2.0 → logxide-0.2.2}/logxide/__init__.py +4 -2
- {logxide-0.2.0 → logxide-0.2.2}/logxide/module_system.py +8 -0
- {logxide-0.2.0 → logxide-0.2.2}/pyproject.toml +2 -2
- {logxide-0.2.0 → logxide-0.2.2}/src/formatter.rs +27 -8
- {logxide-0.2.0 → logxide-0.2.2}/src/globals.rs +9 -6
- {logxide-0.2.0 → logxide-0.2.2}/src/py_logger.rs +20 -7
- logxide-0.2.2/tests/test_caller_info_scope.py +90 -0
- {logxide-0.2.0 → logxide-0.2.2}/tests/test_handler_output.py +44 -0
- {logxide-0.2.0 → logxide-0.2.2}/tests/test_native_fastpath.py +6 -1
- {logxide-0.2.0 → logxide-0.2.2}/tests/test_overflow_flush.py +7 -1
- {logxide-0.2.0 → logxide-0.2.2}/.dockerignore +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/.github/workflows/ci.yml +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/.github/workflows/deploy_docs.yml +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/.github/workflows/publish.yml +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/.gitignore +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/.pre-commit-config.yaml +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/CONTRIBUTING.md +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/Dockerfile +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/LICENSE +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/MANIFEST.in +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/SECURITY.md +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/benchmark/README.md +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/benchmark/_bench_common.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/benchmark/basic_handlers_benchmark.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/benchmark/compare_loggers.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/benchmark/gil_benchmark.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/benchmark/logger_comparison_file_io_20251230_165703.json +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/benchmark/perf_micro.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/benchmark/perf_vs_stdlib.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/benchmark/real_handlers_comparison.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/clippy.toml +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/docker-compose.yml +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/docker-run.sh +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/docs/architecture.md +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/docs/assets/blog/blog-part1-cover.png +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/docs/assets/blog/blog-part2-cover.png +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/docs/compatibility.md +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/docs/development.md +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/docs/installation.md +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/docs/integrations/django.md +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/docs/integrations/fastapi.md +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/docs/integrations/flask.md +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/docs/integrations/index.md +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/docs/performance-bottleneck-report-2026-07-13.md +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/docs/reference.md +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/docs/testing.md +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/docs/third-party-compatibility.md +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/docs/usage.md +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/examples/README.md +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/examples/basic_usage.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/examples/django_integration.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/examples/drop_in_replacement.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/examples/fastapi_advanced.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/examples/fastapi_demo.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/examples/flask_integration.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/examples/format_detailed.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/examples/format_json.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/examples/format_minimal.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/examples/format_production.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/examples/format_simple.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/examples/format_threaded.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/examples/minimal_dropin.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/examples/performance_demo.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/examples/sentry_integration.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/examples/simple_demo.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/examples/third_party_integration.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/logxide/__init__.pyi +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/logxide/compat_functions.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/logxide/compat_handlers.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/logxide/config.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/logxide/fast_logger_wrapper.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/logxide/handlers.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/logxide/interceptor.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/logxide/logger_wrapper.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/logxide/py.typed +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/logxide/pytest_plugin.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/logxide/sentry_integration.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/logxide/testing.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/mkdocs.yml +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/pyrightconfig.json +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/rust-toolchain.toml +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/scripts/README.md +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/scripts/clippy-check.sh +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/scripts/publish.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/scripts/verify_package.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/social_preview.png +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/src/config.rs +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/src/core.rs +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/src/fast_logger.rs +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/src/filter.rs +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/src/handler.rs +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/src/lib.rs +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/src/py_handlers.rs +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/standalone_test.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/test.db +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/tests/conftest.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/tests/docker-compose.sentry.yml +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/tests/test_basic_logging.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/tests/test_caplog_override.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/tests/test_color_formatter.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/tests/test_compat_functions.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/tests/test_compatibility.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/tests/test_config.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/tests/test_doc_codeblocks.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/tests/test_examples.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/tests/test_formatter_planning.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/tests/test_gil_scaling.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/tests/test_handler_routing.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/tests/test_http_auth.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/tests/test_http_handler_features.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/tests/test_integration.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/tests/test_integration_examples.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/tests/test_integration_simple.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/tests/test_interceptor.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/tests/test_logxide_testing.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/tests/test_optimizations.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/tests/test_python315_compat.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/tests/test_sentry_integration.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/tests/test_simple.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/tests/test_timed_rotation.py +0 -0
- {logxide-0.2.0 → logxide-0.2.2}/tmp_test_intercept.py +0 -0
- {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
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: logxide
|
|
3
|
-
Version: 0.2.
|
|
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:
|
|
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
|
-
**
|
|
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
|
-
|
|
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!') #
|
|
65
|
+
logger.info('Hello, world!') # Common patterns: same code, several-fold faster.
|
|
66
66
|
```
|
|
67
67
|
|
|
68
68
|
[](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
|
-
###
|
|
88
|
+
### Benchmarks
|
|
89
89
|
|
|
90
|
-
|
|
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
|
-
|
|
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
|
-
|
|
94
|
+
| Scenario | Speedup vs stdlib |
|
|
95
|
+
| :--------- | :---------------- |
|
|
96
|
+
| simple | **~7–9×** |
|
|
97
|
+
| structured | **~7–9×** |
|
|
98
|
+
| `%`-args | **~5–6×** |
|
|
99
99
|
|
|
100
|
-
|
|
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
|
-
|
|
102
|
+
| Sink | Speedup vs stdlib |
|
|
103
|
+
| :------- | :------------------------ |
|
|
104
|
+
| FILE | **~6–11×** |
|
|
105
|
+
| ROTATING | **~8–14×** |
|
|
106
|
+
| STREAM | **~5×** (async, see note) |
|
|
103
107
|
|
|
104
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
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
|
-
**
|
|
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
|
-
|
|
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!') #
|
|
13
|
+
logger.info('Hello, world!') # Common patterns: same code, several-fold faster.
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
[](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
|
-
###
|
|
36
|
+
### Benchmarks
|
|
37
37
|
|
|
38
|
-
|
|
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
|
-
|
|
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
|
-
|
|
42
|
+
| Scenario | Speedup vs stdlib |
|
|
43
|
+
| :--------- | :---------------- |
|
|
44
|
+
| simple | **~7–9×** |
|
|
45
|
+
| structured | **~7–9×** |
|
|
46
|
+
| `%`-args | **~5–6×** |
|
|
47
47
|
|
|
48
|
-
|
|
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
|
-
|
|
50
|
+
| Sink | Speedup vs stdlib |
|
|
51
|
+
| :------- | :------------------------ |
|
|
52
|
+
| FILE | **~6–11×** |
|
|
53
|
+
| ROTATING | **~8–14×** |
|
|
54
|
+
| STREAM | **~5×** (async, see note) |
|
|
51
55
|
|
|
52
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
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.
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
102
|
+
| Sink | Speedup vs stdlib |
|
|
103
|
+
| :------- | :------------------------ |
|
|
104
|
+
| FILE | **~6–11×** |
|
|
105
|
+
| ROTATING | **~8–14×** |
|
|
106
|
+
| STREAM | **~5×** (async — see note) |
|
|
113
107
|
|
|
114
|
-
|
|
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
|
-
|
|
111
|
+
### Cross-library runner-up snapshot
|
|
122
112
|
|
|
123
|
-
|
|
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 |
|
|
126
|
-
| :------------- |
|
|
127
|
-
|
|
|
128
|
-
|
|
|
129
|
-
| Loguru |
|
|
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
|
-
|
|
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 |
|
|
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
|
|
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 ~
|
|
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`,
|
|
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
|
|
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
|
|
164
|
+
### Speedup vs stdlib (comparable on both Python versions)
|
|
175
165
|
|
|
176
|
-
|
|
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
|
-
|
|
168
|
+
| Scenario | Speedup vs stdlib |
|
|
169
|
+
| :--------- | :---------------- |
|
|
170
|
+
| simple | **~7–9×** |
|
|
171
|
+
| structured | **~7–9×** |
|
|
172
|
+
| `%`-args | **~5–6×** |
|
|
183
173
|
|
|
184
|
-
|
|
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
|
|
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: ~
|
|
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
|
|
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 ~
|
|
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. **
|
|
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,
|
|
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 (~
|
|
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.
|
|
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
|
|
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
|
|
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 |
|
|
171
|
-
| :--------- |
|
|
172
|
-
| Simple msg |
|
|
173
|
-
| Structured |
|
|
174
|
-
| with `%s` args |
|
|
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
|
|
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
|
|
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
|
|