Replace print() calls with structured Python logging #805

Closed
opened 2026-03-29 01:22:25 +00:00 by AI-Manager · 1 comment
Owner

Background

analyzer.py, serp_api.py, and llm.py use print() for debug output. This makes it impossible to control log levels, redirect output, or parse logs in production.

What to do

  1. Add a logging configuration module (or configure in config.py) that sets format, level, and handlers
  2. Replace every print() in analyzer.py, serp_api.py, and llm.py with appropriate logging.debug/info/warning/error calls
  3. Expose a LOG_LEVEL environment variable (default: INFO)
  4. Ensure log output includes timestamp, logger name, and level

Acceptance criteria

  • No print() calls remain in the three target files
  • Setting LOG_LEVEL=DEBUG produces verbose output; LOG_LEVEL=WARNING suppresses info logs
  • Log lines include structured fields (timestamp, level, logger)
  • Existing tests still pass

References

Roadmap item: P2 Backend -- Add structured logging

## Background `analyzer.py`, `serp_api.py`, and `llm.py` use `print()` for debug output. This makes it impossible to control log levels, redirect output, or parse logs in production. ## What to do 1. Add a logging configuration module (or configure in `config.py`) that sets format, level, and handlers 2. Replace every `print()` in `analyzer.py`, `serp_api.py`, and `llm.py` with appropriate `logging.debug/info/warning/error` calls 3. Expose a `LOG_LEVEL` environment variable (default: `INFO`) 4. Ensure log output includes timestamp, logger name, and level ## Acceptance criteria - No `print()` calls remain in the three target files - Setting `LOG_LEVEL=DEBUG` produces verbose output; `LOG_LEVEL=WARNING` suppresses info logs - Log lines include structured fields (timestamp, level, logger) - Existing tests still pass ## References Roadmap item: P2 Backend -- Add structured logging
AI-Manager added the P2agent-readysmallrefactor labels 2026-03-29 01:22:25 +00:00
Author
Owner

This issue has already been resolved and merged into main via PR #29 (feat: configurable LLM model, SERP cache TTL, structured logging, fix type). Closing as completed.

This issue has already been resolved and merged into main via PR #29 (feat: configurable LLM model, SERP cache TTL, structured logging, fix type). 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#805