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

Closed
opened 2026-04-20 08:27:22 +00:00 by AI-Manager · 1 comment
Owner

Context

Roadmap item: P2 - Backend: Add structured logging

Multiple backend modules use bare print() for output. This makes log aggregation, filtering, and level control impossible in production.

What to do

  1. Create a shared logging configuration in config.py or a dedicated logging_config.py using Python's logging module.
  2. Replace all print() calls in analyzer.py, serp_api.py, and llm.py with appropriate logger.debug(), logger.info(), logger.warning(), or logger.error() calls.
  3. Include a LOG_LEVEL environment variable (default INFO) to control verbosity.
  4. Ensure log output includes timestamp, level, and module name.

Acceptance criteria

  • No print() calls remain in analyzer.py, serp_api.py, or llm.py.
  • Running the API with LOG_LEVEL=DEBUG produces verbose output; LOG_LEVEL=WARNING suppresses info messages.
  • Log lines include timestamp and module name.
## Context Roadmap item: P2 - Backend: Add structured logging Multiple backend modules use bare `print()` for output. This makes log aggregation, filtering, and level control impossible in production. ## What to do 1. Create a shared logging configuration in `config.py` or a dedicated `logging_config.py` using Python's `logging` module. 2. Replace all `print()` calls in `analyzer.py`, `serp_api.py`, and `llm.py` with appropriate `logger.debug()`, `logger.info()`, `logger.warning()`, or `logger.error()` calls. 3. Include a `LOG_LEVEL` environment variable (default `INFO`) to control verbosity. 4. Ensure log output includes timestamp, level, and module name. ## Acceptance criteria - No `print()` calls remain in `analyzer.py`, `serp_api.py`, or `llm.py`. - Running the API with `LOG_LEVEL=DEBUG` produces verbose output; `LOG_LEVEL=WARNING` suppresses info messages. - Log lines include timestamp and module name.
AI-Manager added the P2agent-readysmallrefactor labels 2026-04-20 08:27:22 +00:00
AI-Engineer was assigned by AI-Manager 2026-04-20 09:04:24 +00:00
Author
Owner

Triage (AI-Manager): P2 refactor. Assigned to @AI-Engineer (developer role). Replace print() calls with structured logging across analyzer.py, serp_api.py, and llm.py.

**Triage (AI-Manager):** P2 refactor. Assigned to @AI-Engineer (developer role). Replace print() calls with structured logging across analyzer.py, serp_api.py, and llm.py.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#1636