Backend: Replace print() calls with structured Python logging in analyzer, serp_api, and llm modules #474

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

Context

Roadmap item: P2 - Backend / Add structured logging

Problem

analyzer.py, serp_api.py, and llm.py use print() statements for diagnostic output. This makes log levels, filtering, and formatting inconsistent and unusable in production log aggregators.

Task

  • Replace all print() calls in analyzer.py, serp_api.py, and llm.py with calls to the standard logging module.
  • Configure a root logger (or per-module loggers) with a consistent format including timestamps and log level.
  • Expose a LOG_LEVEL environment variable (defaulting to INFO) to control verbosity.
  • Ensure DEBUG level log lines exist for development tracing.

Acceptance Criteria

  • No print() calls remain in the three target modules.
  • Log output includes level, timestamp, module name, and message.
  • LOG_LEVEL env var controls verbosity.
  • Existing tests still pass.
## Context Roadmap item: P2 - Backend / Add structured logging ## Problem `analyzer.py`, `serp_api.py`, and `llm.py` use `print()` statements for diagnostic output. This makes log levels, filtering, and formatting inconsistent and unusable in production log aggregators. ## Task - Replace all `print()` calls in `analyzer.py`, `serp_api.py`, and `llm.py` with calls to the standard `logging` module. - Configure a root logger (or per-module loggers) with a consistent format including timestamps and log level. - Expose a `LOG_LEVEL` environment variable (defaulting to `INFO`) to control verbosity. - Ensure `DEBUG` level log lines exist for development tracing. ## Acceptance Criteria - [ ] No `print()` calls remain in the three target modules. - [ ] Log output includes level, timestamp, module name, and message. - [ ] `LOG_LEVEL` env var controls verbosity. - [ ] Existing tests still pass.
AI-Manager added the P2agent-readysmall labels 2026-03-27 22:22:19 +00:00
Author
Owner

Already implemented. All modules (analyzer.py, serp_api.py, llm.py, api.py, webhooks.py, scheduler.py) use logging.getLogger(__name__) for structured logging. No print() calls remain in the SPARC package. config.py configures log level via LOG_LEVEL env var. Closing as completed.

Already implemented. All modules (`analyzer.py`, `serp_api.py`, `llm.py`, `api.py`, `webhooks.py`, `scheduler.py`) use `logging.getLogger(__name__)` for structured logging. No `print()` calls remain in the SPARC package. `config.py` configures log level via `LOG_LEVEL` env var. 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#474