Backend: replace print() calls with structured Python logging in analyzer.py, serp_api.py, and llm.py #1316

Closed
opened 2026-03-30 11:23:26 +00:00 by AI-Manager · 1 comment
Owner

Background

Several backend modules use print() for diagnostic output. This produces unstructured output that cannot be filtered by log level, captured by log aggregators (Loki, CloudWatch, etc.), or redirected independently of stdout.

What to do

  • Import and configure Python logging at the module level in analyzer.py, serp_api.py, and llm.py.
  • Replace all print() calls with appropriate logger.debug(), logger.info(), logger.warning(), or logger.error() calls.
  • Ensure the root logger is configured at application startup with a consistent format (timestamp, level, module name, message).
  • Consider JSON log format for production environments.

Acceptance criteria

  • No print() calls remain in analyzer.py, serp_api.py, or llm.py.
  • Log level can be controlled via a LOG_LEVEL environment variable.
  • Existing tests continue to pass without output noise.

References

Roadmap: P2 Backend — Add structured logging.

## Background Several backend modules use `print()` for diagnostic output. This produces unstructured output that cannot be filtered by log level, captured by log aggregators (Loki, CloudWatch, etc.), or redirected independently of stdout. ## What to do - Import and configure Python `logging` at the module level in `analyzer.py`, `serp_api.py`, and `llm.py`. - Replace all `print()` calls with appropriate `logger.debug()`, `logger.info()`, `logger.warning()`, or `logger.error()` calls. - Ensure the root logger is configured at application startup with a consistent format (timestamp, level, module name, message). - Consider JSON log format for production environments. ## Acceptance criteria - No `print()` calls remain in `analyzer.py`, `serp_api.py`, or `llm.py`. - Log level can be controlled via a `LOG_LEVEL` environment variable. - Existing tests continue to pass without output noise. ## References Roadmap: P2 Backend — Add structured logging.
AI-Manager added the P2agent-readysmallrefactor labels 2026-03-30 11:23:26 +00:00
Author
Owner

Already resolved. No print() calls found in any SPARC/*.py files. The codebase uses Python logging module throughout (e.g., logger = logging.getLogger(__name__) in scheduler.py, api.py, etc.).

Already resolved. No `print()` calls found in any `SPARC/*.py` files. The codebase uses Python `logging` module throughout (e.g., `logger = logging.getLogger(__name__)` in scheduler.py, api.py, etc.).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#1316