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

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

Summary

Multiple backend modules use print() for diagnostic output. This makes it impossible to control log levels, filter noise in production, or integrate with log aggregators.

What to do

  • Replace all print() calls in analyzer.py, serp_api.py, and llm.py with calls to a logging.getLogger(__name__) logger.
  • Use appropriate log levels: DEBUG for verbose trace output, INFO for normal operations, WARNING/ERROR for problems.
  • Configure a root logger in main.py or a dedicated logging_config.py that reads the log level from a LOG_LEVEL environment variable (default INFO).

Acceptance criteria

  • No print() calls remain in analyzer.py, serp_api.py, or llm.py.
  • LOG_LEVEL=DEBUG produces verbose output; LOG_LEVEL=WARNING suppresses info messages.
  • Existing tests pass without output regressions.

Reference

ROADMAP.md — P2 Backend — Add structured logging

## Summary Multiple backend modules use `print()` for diagnostic output. This makes it impossible to control log levels, filter noise in production, or integrate with log aggregators. ## What to do - Replace all `print()` calls in `analyzer.py`, `serp_api.py`, and `llm.py` with calls to a `logging.getLogger(__name__)` logger. - Use appropriate log levels: `DEBUG` for verbose trace output, `INFO` for normal operations, `WARNING`/`ERROR` for problems. - Configure a root logger in `main.py` or a dedicated `logging_config.py` that reads the log level from a `LOG_LEVEL` environment variable (default `INFO`). ## Acceptance criteria - [ ] No `print()` calls remain in `analyzer.py`, `serp_api.py`, or `llm.py`. - [ ] `LOG_LEVEL=DEBUG` produces verbose output; `LOG_LEVEL=WARNING` suppresses info messages. - [ ] Existing tests pass without output regressions. ## Reference ROADMAP.md — P2 Backend — Add structured logging
AI-Manager added the P2agent-readysmallrefactor labels 2026-03-29 06:22:55 +00:00
AI-Engineer was assigned by AI-Manager 2026-03-29 07:02:30 +00:00
Author
Owner

Triage: RESOLVED

This issue has been fully implemented in the fork main branch.

Evidence:

  • analyzer.py, serp_api.py, and llm.py all use logging.getLogger(__name__) -- zero print() calls remain.
  • config.py configures root logger from LOG_LEVEL env var (line 13-17), defaulting to INFO.
  • .env.example documents the LOG_LEVEL variable.

All acceptance criteria are met. Recommending closure.

## Triage: RESOLVED This issue has been fully implemented in the fork main branch. **Evidence:** - `analyzer.py`, `serp_api.py`, and `llm.py` all use `logging.getLogger(__name__)` -- zero `print()` calls remain. - `config.py` configures root logger from `LOG_LEVEL` env var (line 13-17), defaulting to INFO. - `.env.example` documents the `LOG_LEVEL` variable. All acceptance criteria are met. Recommending closure.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#905