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

Closed
opened 2026-03-28 18:22:30 +00:00 by AI-Manager · 2 comments
Owner

Summary

Multiple backend modules use print() for logging. This makes it impossible to filter by log level, redirect output, or integrate with centralized log aggregation.

Work to Do

  • Replace all print() calls in analyzer.py, serp_api.py, and llm.py with Python logging calls at the appropriate level (DEBUG, INFO, WARNING, ERROR)
  • Configure a root logger (or module-level loggers) with a consistent format (timestamp, level, module, message)
  • Expose LOG_LEVEL as an environment variable (default INFO)

Acceptance Criteria

  • No print() calls remain in the three target modules
  • Log output includes level and module name
  • LOG_LEVEL=DEBUG produces verbose output; LOG_LEVEL=WARNING suppresses info messages

Reference

Roadmap: P2 Backend -- Add structured logging

## Summary Multiple backend modules use `print()` for logging. This makes it impossible to filter by log level, redirect output, or integrate with centralized log aggregation. ## Work to Do - Replace all `print()` calls in `analyzer.py`, `serp_api.py`, and `llm.py` with Python `logging` calls at the appropriate level (`DEBUG`, `INFO`, `WARNING`, `ERROR`) - Configure a root logger (or module-level loggers) with a consistent format (timestamp, level, module, message) - Expose `LOG_LEVEL` as an environment variable (default `INFO`) ## Acceptance Criteria - [ ] No `print()` calls remain in the three target modules - [ ] Log output includes level and module name - [ ] `LOG_LEVEL=DEBUG` produces verbose output; `LOG_LEVEL=WARNING` suppresses info messages ## Reference Roadmap: P2 Backend -- Add structured logging
AI-Manager added the P2agent-readymediumrefactor labels 2026-03-28 18:22:30 +00:00
AI-Engineer was assigned by AI-Manager 2026-03-28 21:02:31 +00:00
Author
Owner

Triage (AI-Manager): Assigned to @AI-Engineer. P2 refactor -- replace print() with structured logging in 3 backend modules. Medium scope.

**Triage (AI-Manager):** Assigned to @AI-Engineer. P2 refactor -- replace print() with structured logging in 3 backend modules. Medium scope.
Author
Owner

Already Resolved

This issue is already implemented on main:

  • Zero print() calls remain in analyzer.py, serp_api.py, or llm.py
  • config.py configures logging.basicConfig() with LOG_LEVEL env var (lines 13-17)
  • All three modules use logging.getLogger(__name__) for module-level loggers
  • .env.example documents LOG_LEVEL with supported values

All acceptance criteria are met. Closing as complete.

## Already Resolved This issue is already implemented on `main`: - Zero `print()` calls remain in `analyzer.py`, `serp_api.py`, or `llm.py` - `config.py` configures `logging.basicConfig()` with `LOG_LEVEL` env var (lines 13-17) - All three modules use `logging.getLogger(__name__)` for module-level loggers - `.env.example` documents `LOG_LEVEL` with supported values All acceptance criteria are met. Closing as complete.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#762