Skip to content

Route Rust logs through Python logging via pyo3-log - #66

Open
zexoverz wants to merge 1 commit into
enviodev:mainfrom
zexoverz:45-pyo3-log
Open

zexoverz wants to merge 1 commit into
enviodev:mainfrom
zexoverz:45-pyo3-log

Conversation

@zexoverz

@zexoverz zexoverz commented Sep 15, 2026

Copy link
Copy Markdown

Swaps env_logger for pyo3-log as suggested in the thread, so records from hypersync-client land on the hypersync_client logger and can be handled with normal Python logging config. Closes #45.

Summary by CodeRabbit

  • New Features

    • Rust core logs are now forwarded through Python’s standard logging module.
    • Client and HTTP logs are available under dedicated logger names.
  • Documentation

    • Added logging configuration guidance, including logger levels and setup timing.

Replaces env_logger with pyo3-log so log records from hypersync-client show up under the hypersync_client logger in Python. Closes enviodev#45.
@coderabbitai

coderabbitai Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: e07efec1-7154-4fb4-a615-f881f3965bdf

📥 Commits

Reviewing files that changed from the base of the PR and between 35797ae and 423f80d.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (3)
  • Cargo.toml
  • README.md
  • src/lib.rs

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The Python extension now forwards Rust logs through Python’s logging module. Module-level initialization replaces client-level env_logger initialization, and the README documents logger names and configuration timing.

Changes

Logging integration

Layer / File(s) Summary
Logger dependency and initialization
Cargo.toml, src/lib.rs
The project replaces env_logger with pyo3-log. The hypersync module calls pyo3_log::try_init(), and HypersyncClient::new no longer initializes env_logger.
Python logging documentation
README.md
The README documents the hypersync_client and reqwest loggers, configuration examples, and configuration timing before the first client call.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant Python as Python logging
  participant Hypersync as hypersync module
  participant Rust as Rust core
  Python->>Hypersync: import module
  Hypersync->>Python: initialize pyo3-log forwarding
  Rust->>Python: emit log record
  Python-->>Python: route record to configured handlers
Loading

Suggested reviewers: jonoprest

Merge Risk: ⚪ Minimal · up to 423f8

The logging bridge can be merged with normal checks; no concrete current-head issue remains.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: routing Rust logs through Python logging with pyo3-log.
Linked Issues check ✅ Passed The pull request meets the coding requirement in issue #45. src/lib.rs initializes pyo3_log::try_init() in the PyO3 module and routes Rust log records to Python logging. The README.md document…
Out of Scope Changes check ✅ Passed The changes stay within issue #45. The dependency replacement, module initialization, constructor cleanup, and logging documentation directly implement or explain Python logging integration. No unrela…
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 1 files. (2 skipped: 2 …

Warning

Tools execution failed with the following error:

Failed to run tools: 14 UNAVAILABLE: Connection dropped


Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python client logs are not capturable via Python logging (stdout/stderr only, pyo3 Rust backend)

1 participant