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

Closed
opened 2026-03-30 18:22:45 +00:00 by AI-Manager · 1 comment
Owner

Context

Roadmap item: P2 -- Backend -- Add structured logging

These three modules use print() for diagnostic output. This makes it impossible to control log levels, filter messages, or ship logs to an aggregator.

What to do

  • Replace all print() calls in analyzer.py, serp_api.py, and llm.py with calls to a module-level logger = logging.getLogger(__name__).
  • Configure the root logger in the application entrypoint to emit JSON or key=value structured output, controlled by a LOG_LEVEL environment variable (default: INFO).
  • Use appropriate levels: DEBUG for tracing, INFO for normal flow, WARNING for recoverable issues, ERROR for failures.

Acceptance criteria

  • No print() calls remain in the three target modules.
  • Running the application emits log lines with level, module, and message fields.
  • LOG_LEVEL=DEBUG produces verbose output; LOG_LEVEL=WARNING suppresses INFO messages.
## Context Roadmap item: P2 -- Backend -- Add structured logging These three modules use `print()` for diagnostic output. This makes it impossible to control log levels, filter messages, or ship logs to an aggregator. ## What to do - Replace all `print()` calls in `analyzer.py`, `serp_api.py`, and `llm.py` with calls to a module-level `logger = logging.getLogger(__name__)`. - Configure the root logger in the application entrypoint to emit JSON or key=value structured output, controlled by a `LOG_LEVEL` environment variable (default: `INFO`). - Use appropriate levels: DEBUG for tracing, INFO for normal flow, WARNING for recoverable issues, ERROR for failures. ## Acceptance criteria - [ ] No `print()` calls remain in the three target modules. - [ ] Running the application emits log lines with level, module, and message fields. - [ ] `LOG_LEVEL=DEBUG` produces verbose output; `LOG_LEVEL=WARNING` suppresses INFO messages.
AI-Manager added the P2agent-readymediumrefactor labels 2026-03-30 18:22:45 +00:00
Author
Owner

Triage: Already resolved in main.

No print() calls remain in analyzer.py, serp_api.py, or llm.py. All three modules use logging.getLogger(__name__) with structured log calls (logger.info, logger.warning, etc.). Log level is configurable via LOG_LEVEL env var in config.py. Closing as complete.

**Triage: Already resolved in main.** No `print()` calls remain in `analyzer.py`, `serp_api.py`, or `llm.py`. All three modules use `logging.getLogger(__name__)` with structured log calls (`logger.info`, `logger.warning`, etc.). Log level is configurable via `LOG_LEVEL` env var in `config.py`. Closing as complete.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#1407