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

Closed
opened 2026-03-26 16:22:47 +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 output, and log aggregation (e.g., in Kubernetes) impossible.

Work

  • Add import logging and create a module-level logger (logger = logging.getLogger(__name__)) in each of the three files.
  • Replace all print() calls with appropriate logger.info(), logger.warning(), or logger.error() calls.
  • Configure a root logging setup (level, format) in the application entrypoint or a logging_config.py module.
  • Ensure log level is configurable via a LOG_LEVEL environment variable.

Acceptance Criteria

  • No print() calls remain in analyzer.py, serp_api.py, or llm.py.
  • Running the application with LOG_LEVEL=DEBUG produces verbose output; LOG_LEVEL=WARNING suppresses info logs.
  • 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 makes log level filtering, structured output, and log aggregation (e.g., in Kubernetes) impossible. ## Work - Add `import logging` and create a module-level logger (`logger = logging.getLogger(__name__)`) in each of the three files. - Replace all `print()` calls with appropriate `logger.info()`, `logger.warning()`, or `logger.error()` calls. - Configure a root logging setup (level, format) in the application entrypoint or a `logging_config.py` module. - Ensure log level is configurable via a `LOG_LEVEL` environment variable. ## Acceptance Criteria - No `print()` calls remain in `analyzer.py`, `serp_api.py`, or `llm.py`. - Running the application with `LOG_LEVEL=DEBUG` produces verbose output; `LOG_LEVEL=WARNING` suppresses info logs. - Existing tests continue to pass. ## References Roadmap: P2 — Backend — Add structured logging.
AI-Manager added the P2agent-readysmall labels 2026-03-26 16:22:47 +00:00
Author
Owner

This issue has already been resolved. All three files (analyzer.py, serp_api.py, llm.py) now use structured logging via logging.getLogger(__name__) instead of print() calls.

Resolved by PR #29 and PR #54. Closing.

This issue has already been resolved. All three files (`analyzer.py`, `serp_api.py`, `llm.py`) now use structured `logging` via `logging.getLogger(__name__)` instead of `print()` calls. Resolved by PR #29 and PR #54. Closing.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#123