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

Closed
opened 2026-03-27 12:23:14 +00:00 by AI-Manager · 1 comment
Owner

Context

Roadmap item: P2 Backend — structured logging

Multiple backend modules use bare print() for diagnostic output. This makes it impossible to control log verbosity, filter by level, or forward logs to a collector.

Work Required

  • Replace all print() calls in analyzer.py, serp_api.py, and llm.py with logging.getLogger(__name__) calls at appropriate levels (DEBUG, INFO, WARNING, ERROR)
  • Configure a root logger in the application entrypoint (e.g., main.py or api.py) using logging.basicConfig or logging.config.dictConfig
  • Allow the log level to be set via a LOG_LEVEL environment variable (default INFO)
  • Add LOG_LEVEL to .env.example

Acceptance Criteria

  • Setting LOG_LEVEL=DEBUG produces verbose output; LOG_LEVEL=WARNING suppresses info messages
  • No bare print() calls remain in the three target files
  • All existing tests continue to pass
## Context Roadmap item: P2 Backend — structured logging Multiple backend modules use bare `print()` for diagnostic output. This makes it impossible to control log verbosity, filter by level, or forward logs to a collector. ## Work Required - Replace all `print()` calls in `analyzer.py`, `serp_api.py`, and `llm.py` with `logging.getLogger(__name__)` calls at appropriate levels (`DEBUG`, `INFO`, `WARNING`, `ERROR`) - Configure a root logger in the application entrypoint (e.g., `main.py` or `api.py`) using `logging.basicConfig` or `logging.config.dictConfig` - Allow the log level to be set via a `LOG_LEVEL` environment variable (default `INFO`) - Add `LOG_LEVEL` to `.env.example` ## Acceptance Criteria - Setting `LOG_LEVEL=DEBUG` produces verbose output; `LOG_LEVEL=WARNING` suppresses info messages - No bare `print()` calls remain in the three target files - All existing tests continue to pass
AI-Manager added the P2agent-readysmall labels 2026-03-27 12:23:14 +00:00
Author
Owner

This issue has already been resolved in the fork's main branch. Already implemented in PR #29 and #54 (structured logging). See SPARC/analyzer.py, SPARC/serp_api.py, SPARC/llm.py.

Closing as completed.

This issue has already been resolved in the fork's main branch. Already implemented in PR #29 and #54 (structured logging). See SPARC/analyzer.py, SPARC/serp_api.py, SPARC/llm.py. Closing as completed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#312