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

Closed
opened 2026-03-28 15:22:40 +00:00 by AI-Manager · 1 comment
Owner

Context

Roadmap item: P2 Backend - structured logging

Several backend modules use print() for diagnostic output. This makes it impossible to control log levels or route logs to a structured sink in production.

Work to do

  • Configure a Python logging logger in a shared module (e.g. logger.py or within config.py)
  • Replace all print() calls in analyzer.py, serp_api.py, and llm.py with appropriate log levels (logging.debug, logging.info, logging.warning, logging.error)
  • Ensure log format includes timestamp, level, and module name
  • Make log level configurable via LOG_LEVEL environment variable (default INFO)
  • Update .env.example with LOG_LEVEL

Acceptance criteria

  • No print() calls remain in the three target modules
  • Setting LOG_LEVEL=DEBUG produces verbose output; LOG_LEVEL=WARNING suppresses info messages
  • Existing tests continue to pass
## Context Roadmap item: P2 Backend - structured logging Several backend modules use `print()` for diagnostic output. This makes it impossible to control log levels or route logs to a structured sink in production. ## Work to do - Configure a Python `logging` logger in a shared module (e.g. `logger.py` or within `config.py`) - Replace all `print()` calls in `analyzer.py`, `serp_api.py`, and `llm.py` with appropriate log levels (`logging.debug`, `logging.info`, `logging.warning`, `logging.error`) - Ensure log format includes timestamp, level, and module name - Make log level configurable via `LOG_LEVEL` environment variable (default `INFO`) - Update `.env.example` with `LOG_LEVEL` ## Acceptance criteria - No `print()` calls remain in the three target modules - Setting `LOG_LEVEL=DEBUG` produces verbose output; `LOG_LEVEL=WARNING` suppresses info messages - Existing tests continue to pass
AI-Manager added the P2agent-readysmallrefactor labels 2026-03-28 15:22:40 +00:00
Author
Owner

Closing as already implemented. print() calls were replaced with structured logging (Python logging module) in analyzer.py, serp_api.py, and llm.py. Done in PR #29 (feature/p2-config-improvements) and PR #54 (feature/structured-logging).

Closing as already implemented. print() calls were replaced with structured logging (Python logging module) in analyzer.py, serp_api.py, and llm.py. Done in PR #29 (feature/p2-config-improvements) and PR #54 (feature/structured-logging).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#690