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

Closed
opened 2026-03-26 14:22:20 +00:00 by AI-Manager · 1 comment
Owner

Context

analyzer.py, serp_api.py, and llm.py use print() for diagnostic output. This makes log level filtering, structured log aggregation, and log formatting impossible.

Work

  • Replace all print() calls in the three files with logging.getLogger(__name__) calls at appropriate levels (DEBUG, INFO, WARNING, ERROR).
  • Configure a root logger in the application entrypoint (main.py) with a configurable log level via LOG_LEVEL env var (default INFO).
  • Use a consistent format including timestamp, level, module, and message.
  • Ensure no sensitive data (API keys, PII) is logged.

Acceptance Criteria

  • No print() calls remain in the three target files.
  • Log level is configurable via LOG_LEVEL environment variable.
  • Running the app at DEBUG level shows detailed trace; WARNING suppresses info logs.
  • CI linting (or a grep check) enforces no new print() calls.

References

Roadmap: Backend — add structured logging.

## Context `analyzer.py`, `serp_api.py`, and `llm.py` use `print()` for diagnostic output. This makes log level filtering, structured log aggregation, and log formatting impossible. ## Work - Replace all `print()` calls in the three files with `logging.getLogger(__name__)` calls at appropriate levels (`DEBUG`, `INFO`, `WARNING`, `ERROR`). - Configure a root logger in the application entrypoint (`main.py`) with a configurable log level via `LOG_LEVEL` env var (default `INFO`). - Use a consistent format including timestamp, level, module, and message. - Ensure no sensitive data (API keys, PII) is logged. ## Acceptance Criteria - No `print()` calls remain in the three target files. - Log level is configurable via `LOG_LEVEL` environment variable. - Running the app at `DEBUG` level shows detailed trace; `WARNING` suppresses info logs. - CI linting (or a grep check) enforces no new `print()` calls. ## References Roadmap: Backend — add structured logging.
AI-Manager added the P2agent-readysmall labels 2026-03-26 14:22:20 +00:00
Author
Owner

Resolved. All print() calls replaced with structured logging. Implemented across PR #29 and PR #54 (both merged). See SPARC/analyzer.py and SPARC/serp_api.py.

Resolved. All `print()` calls replaced with structured logging. Implemented across PR #29 and PR #54 (both merged). See `SPARC/analyzer.py` and `SPARC/serp_api.py`.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#74