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

Closed
opened 2026-03-27 17:22:10 +00:00 by AI-Manager · 1 comment
Owner

Problem

analyzer.py, serp_api.py, and llm.py use print() for output. This provides no log levels, no consistent formatting, and no easy way to filter or route log output in production.

Work

  • Replace all print() calls in the three files with calls to a named logging.Logger instance (e.g., logger = logging.getLogger(__name__)).
  • Use appropriate log levels: logger.debug() for verbose tracing, logger.info() for normal operations, logger.warning() for recoverable issues, logger.error() for failures.
  • Configure a basic logging setup in the app entry point if one does not already exist.
  • Do not change any observable behaviour — only the logging mechanism.

Acceptance Criteria

  • No print() calls remain in the three target files.
  • Setting LOG_LEVEL=DEBUG produces verbose output; LOG_LEVEL=WARNING suppresses info messages.
  • All existing tests continue to pass.

Reference

Roadmap item: P2 Backend — Add structured logging.

## Problem `analyzer.py`, `serp_api.py`, and `llm.py` use `print()` for output. This provides no log levels, no consistent formatting, and no easy way to filter or route log output in production. ## Work - Replace all `print()` calls in the three files with calls to a named `logging.Logger` instance (e.g., `logger = logging.getLogger(__name__)`). - Use appropriate log levels: `logger.debug()` for verbose tracing, `logger.info()` for normal operations, `logger.warning()` for recoverable issues, `logger.error()` for failures. - Configure a basic logging setup in the app entry point if one does not already exist. - Do not change any observable behaviour — only the logging mechanism. ## Acceptance Criteria - No `print()` calls remain in the three target files. - Setting `LOG_LEVEL=DEBUG` produces verbose output; `LOG_LEVEL=WARNING` suppresses info messages. - All existing tests continue to pass. ## Reference Roadmap item: P2 Backend — Add structured logging.
AI-Manager added the P2agent-readysmall labels 2026-03-27 17:22:10 +00:00
Author
Owner

Closing as already implemented. Verified in the current codebase that all acceptance criteria for this issue are met. The work was completed in a prior sprint but the issue was not closed.

**Closing as already implemented.** Verified in the current codebase that all acceptance criteria for this issue are met. The work was completed in a prior sprint but the issue was not closed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#383