Skip to content

Comments

feat: complete structlog migration (Phase 3b — remaining modules)#224

Open
arthurfantaci wants to merge 6 commits intomainfrom
rc/structlog-remaining
Open

feat: complete structlog migration (Phase 3b — remaining modules)#224
arthurfantaci wants to merge 6 commits intomainfrom
rc/structlog-remaining

Conversation

@arthurfantaci
Copy link
Owner

Summary

Complete the structlog migration started in Phase 3a (#219). All remaining 26 modules
now use structlog instead of stdlib logging.

Changes

  • Migrate 15 evaluation/graph/core utility modules (standard conversion)
  • Migrate 5 guardrails modules (named logger, extra={} → keyword args)
  • Migrate 3 auth modules (6 extra={} calls, named logger, type hints)
  • Migrate observability.py (standard conversion)
  • Migrate 6 test_events.py tests from caplog to structlog.testing.capture_logs()
  • Remove logging.basicConfig bridge from api.py (no longer needed)

Result

  • Zero logging.getLogger() calls remain in application code
  • Named loggers ("audit", "guardrails") use structlog.get_logger(name)
  • import logging only retained where level constants (logging.WARNING) are used

Test plan

  • 813 tests pass
  • Ruff lint + format clean
  • All 4 commits verified independently

Closes #222

🤖 Generated with Claude Code

arthurfantaci and others added 5 commits February 22, 2026 18:48
Migrate 15 modules from stdlib logging to structlog:
- evaluation/{ragas_evaluators,cost_analysis,conversational_evaluators,golden_dataset,regression}
- graph, prompts/catalog
- core/{standards,definitions,embeddings,conversation}
- core/agentic/{orchestrator,streaming,checkpoints}
- core/agentic/subgraphs/{rag,synthesis}

Part of #222

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Migrate 5 guardrails modules from stdlib logging to structlog:
- hallucination.py, pii_detection.py, toxicity.py: standard conversion
- output_filter.py: convert extra={} dict to keyword args
- events.py: named logger "guardrails" via structlog.get_logger(),
  convert extra={} to keyword args, keep import logging for level constants

Part of #222

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Migrate 3 auth modules from stdlib logging to structlog:
- postgres_store.py: standard conversion
- middleware.py: convert 6 extra={} calls to keyword args
- audit.py: named logger "audit" via structlog.get_logger(),
  add module-level logger for error handling, convert extra={}
  to keyword args, update type hint, keep import logging for
  level constants

Part of #222

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- observability.py: standard conversion to structlog
- test_events.py: migrate 6 caplog tests to structlog.testing.capture_logs()
- api.py: remove logging.basicConfig bridge (all named loggers now use structlog)

Closes #222

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
feat(structlog): complete migration of remaining modules (Phase 3b)
@vercel
Copy link

vercel bot commented Feb 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
frontend Ready Ready Preview, Comment Feb 22, 2026 11:58pm

Request Review

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Feb 22, 2026

Codecov Report

❌ Patch coverage is 90.90909% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...aphrag_api/evaluation/conversational_evaluators.py 0.00% 2 Missing ⚠️
backend/src/requirements_graphrag_api/graph.py 0.00% 2 Missing ⚠️
...ackend/src/requirements_graphrag_api/auth/audit.py 83.33% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

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.

feat: complete structlog migration (Phase 3b — remaining modules)

1 participant