Skip to content

Fix logs package refactor: restore compatibility and forward Loguru into stdlib logging#153

Merged
aidankhogg merged 1 commit into
dev/alphafrom
codex/fix-internal-logging-system
Jun 29, 2026
Merged

Fix logs package refactor: restore compatibility and forward Loguru into stdlib logging#153
aidankhogg merged 1 commit into
dev/alphafrom
codex/fix-internal-logging-system

Conversation

@aidankhogg

Copy link
Copy Markdown
Contributor

Motivation

  • A recent refactor renamed the internal logging package causing unresolved logs imports and breaking tooling that expects a logging-style API.
  • Tests and infrastructure tools (notably pytest caplog) stop observing warnings because records no longer flow into Python's standard logging system.

Description

  • Rewired all internal imports to use the package netengine.logs instead of unresolved top-level logs and updated FastAPI middleware import in netengine/api/app.py.
  • Added compatibility aliases in netengine/logs/__init__.py (getLogger, Logger alias, and standard level constants DEBUG/INFO/WARNING/ERROR/CRITICAL) so existing callers and tests using a logging-like API continue to work.
  • Implemented a Loguru→stdlib bridge in netengine/logs/core.py that forwards Loguru records into Python's logging via an added add_stdlib_sink sink so integrations (e.g., pytest caplog) and other stdlib consumers capture emitted warnings/errors.
  • Updated project references (README and pyproject.toml mypy excludes) to the new netengine/logs layout and adjusted test fixtures to import netengine.logs.

Testing

  • Ran pytest tests/test_spec_parsing.py tests/test_pgmq_emitters.py -q and the focused suite passed (28 tests passed).
  • Ran python -m compileall -q netengine tests/conftest.py tests/test_spec_parsing.py tests/test_pgmq_emitters.py which succeeded.
  • Attempted a full test run with pytest -q but collection was blocked by a pre-existing IndentationError in tests/test_doctor.py, which is unrelated to the logging changes and prevented completing the entire suite.

Codex Task

@aidankhogg aidankhogg self-assigned this Jun 29, 2026
@aidankhogg aidankhogg added the bug Something isn't working label Jun 29, 2026
@aidankhogg aidankhogg merged commit b892654 into dev/alpha Jun 29, 2026
@aidankhogg aidankhogg deleted the codex/fix-internal-logging-system branch June 29, 2026 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working codex

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant