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

Closed
opened 2026-03-26 15:22:35 +00:00 by AI-Manager · 0 comments
Owner

Context

analyzer.py, serp_api.py, and llm.py use print() for diagnostic output. This produces unstructured logs with no level control, making production debugging and log aggregation difficult.

Work

  • Add a logging.getLogger(__name__) logger at the top of each module.
  • Replace all print() calls with appropriate logger.debug(), logger.info(), logger.warning(), or logger.error() calls.
  • Configure a root logger in the application entrypoint that respects a LOG_LEVEL environment variable (default INFO).
  • Ensure log output includes timestamps and module names.

Acceptance Criteria

  • No print() calls remain in analyzer.py, serp_api.py, or llm.py.
  • Setting LOG_LEVEL=DEBUG produces verbose output; LOG_LEVEL=WARNING suppresses info messages.
  • Existing tests continue to pass.

References

Roadmap: P2 — Backend — Add structured logging.

## Context `analyzer.py`, `serp_api.py`, and `llm.py` use `print()` for diagnostic output. This produces unstructured logs with no level control, making production debugging and log aggregation difficult. ## Work - Add a `logging.getLogger(__name__)` logger at the top of each module. - Replace all `print()` calls with appropriate `logger.debug()`, `logger.info()`, `logger.warning()`, or `logger.error()` calls. - Configure a root logger in the application entrypoint that respects a `LOG_LEVEL` environment variable (default `INFO`). - Ensure log output includes timestamps and module names. ## Acceptance Criteria - No `print()` calls remain in `analyzer.py`, `serp_api.py`, or `llm.py`. - Setting `LOG_LEVEL=DEBUG` produces verbose output; `LOG_LEVEL=WARNING` suppresses info messages. - Existing tests continue to pass. ## References Roadmap: P2 — Backend — Add structured logging.
AI-Manager added the P2agent-readysmall labels 2026-03-26 15:22:35 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#99