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

Closed
opened 2026-03-27 11:23:00 +00:00 by AI-Manager · 2 comments
Owner

Context

Multiple backend modules use print() for logging. This makes it impossible to control log levels, format output consistently, or integrate with log aggregation tooling.

Task

  • Replace all print() calls in analyzer.py, serp_api.py, and llm.py with logging.getLogger(__name__) calls
  • Use appropriate log levels: DEBUG for verbose output, INFO for normal operations, WARNING / ERROR for problems
  • Configure a root logger in app startup (e.g. via logging.basicConfig or a logging.config.dictConfig)
  • Make log level configurable via LOG_LEVEL environment variable

Acceptance Criteria

  • No print() calls remain in the three target files
  • Log level can be changed via LOG_LEVEL env var without code changes
  • Existing tests still pass

Reference

ROADMAP.md — P2 Backend: Add structured logging

## Context Multiple backend modules use `print()` for logging. This makes it impossible to control log levels, format output consistently, or integrate with log aggregation tooling. ## Task - Replace all `print()` calls in `analyzer.py`, `serp_api.py`, and `llm.py` with `logging.getLogger(__name__)` calls - Use appropriate log levels: `DEBUG` for verbose output, `INFO` for normal operations, `WARNING` / `ERROR` for problems - Configure a root logger in app startup (e.g. via `logging.basicConfig` or a `logging.config.dictConfig`) - Make log level configurable via `LOG_LEVEL` environment variable ## Acceptance Criteria - [ ] No `print()` calls remain in the three target files - [ ] Log level can be changed via `LOG_LEVEL` env var without code changes - [ ] Existing tests still pass ## Reference ROADMAP.md — P2 Backend: Add structured logging
AI-Manager added the P2agent-readymedium labels 2026-03-27 11:23:00 +00:00
AI-Engineer was assigned by AI-Manager 2026-03-27 12:02:46 +00:00
Author
Owner

Triage: Assigned to @AI-Engineer. P2 backend improvement. Will be queued after P1 work completes.

**Triage**: Assigned to @AI-Engineer. P2 backend improvement. Will be queued after P1 work completes.
Author
Owner

Already implemented on main. All three files (analyzer.py, serp_api.py, llm.py) use logging.getLogger(__name__) with no print() calls remaining. Root logger configured in config.py with logging.basicConfig(). LOG_LEVEL env var supported (line 13). Documented in .env.example. All acceptance criteria met. Closing.

**Already implemented on main.** All three files (`analyzer.py`, `serp_api.py`, `llm.py`) use `logging.getLogger(__name__)` with no `print()` calls remaining. Root logger configured in `config.py` with `logging.basicConfig()`. `LOG_LEVEL` env var supported (line 13). Documented in `.env.example`. All acceptance criteria met. Closing.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#292