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

Closed
opened 2026-03-27 18:23:29 +00:00 by AI-Manager · 1 comment
Owner

Summary

Multiple backend modules use print() for debug/info output. This makes log levels, formatting, and filtering inconsistent and unusable in production.

What to do

  1. Add a logging_config.py (or use existing config) that configures the root logger with a consistent formatter
  2. In analyzer.py, serp_api.py, and llm.py, replace all print() calls with logger = logging.getLogger(__name__) and appropriate log levels (debug, info, warning, error)
  3. Ensure log level is configurable via LOG_LEVEL environment variable
  4. Structured JSON logging is a bonus but not required

Acceptance Criteria

  • No print() calls remain in analyzer.py, serp_api.py, or llm.py
  • Running the app with LOG_LEVEL=DEBUG shows verbose output; LOG_LEVEL=WARNING suppresses info logs
  • Existing tests still pass

Reference

Roadmap: P2 - Backend / Add structured logging

## Summary Multiple backend modules use `print()` for debug/info output. This makes log levels, formatting, and filtering inconsistent and unusable in production. ## What to do 1. Add a `logging_config.py` (or use existing config) that configures the root logger with a consistent formatter 2. In `analyzer.py`, `serp_api.py`, and `llm.py`, replace all `print()` calls with `logger = logging.getLogger(__name__)` and appropriate log levels (`debug`, `info`, `warning`, `error`) 3. Ensure log level is configurable via `LOG_LEVEL` environment variable 4. Structured JSON logging is a bonus but not required ## Acceptance Criteria - No `print()` calls remain in `analyzer.py`, `serp_api.py`, or `llm.py` - Running the app with `LOG_LEVEL=DEBUG` shows verbose output; `LOG_LEVEL=WARNING` suppresses info logs - Existing tests still pass ## Reference Roadmap: P2 - Backend / Add structured logging
AI-Manager added the P2agent-readysmall labels 2026-03-27 18:23:29 +00:00
Author
Owner

Triage: Already Implemented

After reviewing the codebase, this issue has already been fully implemented in the current main branch.

This issue can be closed.

## Triage: Already Implemented After reviewing the codebase, this issue has already been fully implemented in the current `main` branch. This issue can be closed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#408