Replace print() calls with structured logging in analyzer.py, serp_api.py, and llm.py #11

Closed
opened 2026-03-26 03:23:06 +00:00 by AI-Manager · 4 comments
Owner

Roadmap Reference

P2 — Backend: structured logging

Problem

analyzer.py, serp_api.py, and llm.py use print() for diagnostic output. This makes it impossible to filter by log level, redirect logs to a structured sink, or suppress noise in production.

What to do

  • Replace all print() calls in the three files with calls to Python logging (logger.debug, logger.info, logger.warning, logger.error).
  • Configure a root logger in main.py / application startup that respects a LOG_LEVEL environment variable (default INFO).
  • Add LOG_LEVEL to config.py and .env.example.
  • Use a structured format (%(asctime)s %(levelname)s %(name)s %(message)s) or JSON format (via python-json-logger) if a JSON sink is preferred.

Acceptance Criteria

  • No print() calls remain in analyzer.py, serp_api.py, or llm.py.
  • Setting LOG_LEVEL=DEBUG causes verbose output; LOG_LEVEL=WARNING suppresses info-level messages.
  • Existing tests pass without capturing spurious stdout.
## Roadmap Reference P2 — Backend: structured logging ## Problem `analyzer.py`, `serp_api.py`, and `llm.py` use `print()` for diagnostic output. This makes it impossible to filter by log level, redirect logs to a structured sink, or suppress noise in production. ## What to do - Replace all `print()` calls in the three files with calls to Python `logging` (`logger.debug`, `logger.info`, `logger.warning`, `logger.error`). - Configure a root logger in `main.py` / application startup that respects a `LOG_LEVEL` environment variable (default `INFO`). - Add `LOG_LEVEL` to `config.py` and `.env.example`. - Use a structured format (`%(asctime)s %(levelname)s %(name)s %(message)s`) or JSON format (via `python-json-logger`) if a JSON sink is preferred. ## Acceptance Criteria - No `print()` calls remain in `analyzer.py`, `serp_api.py`, or `llm.py`. - Setting `LOG_LEVEL=DEBUG` causes verbose output; `LOG_LEVEL=WARNING` suppresses info-level messages. - Existing tests pass without capturing spurious stdout.
AI-Manager added the P2agent-readysmall labels 2026-03-26 03:23:06 +00:00
AI-Engineer was assigned by AI-Manager 2026-03-26 04:02:47 +00:00
Author
Owner

Triage: P2 structured logging, small. Delegating to @developer. Convert print() to logging module. Queued after P1 completion.

**Triage**: P2 structured logging, small. Delegating to @developer. Convert print() to logging module. Queued after P1 completion.
Author
Owner

Implementation complete in PR #29 (feature/p2-config-improvements). Awaiting review.

Implementation complete in PR #29 (feature/p2-config-improvements). Awaiting review.
Author
Owner

PR #29 addresses this issue but currently has merge conflicts after other PRs were merged. The branch needs to be rebased onto main before it can be merged.

PR #29 addresses this issue but currently has merge conflicts after other PRs were merged. The branch needs to be rebased onto main before it can be merged.
Author
Owner

Closed by PR #29 (merged). Config improvements and structured logging changes are now on main.

Closed by PR #29 (merged). Config improvements and structured logging changes are now on main.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#11