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

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

Context

analyzer.py, serp_api.py, and llm.py use bare print() statements. This makes it impossible to filter by log level, redirect output, or apply consistent formatting in production.

Roadmap reference: ROADMAP.md > P2 > Backend > Add structured logging

What to do

  • Create a shared logger (e.g. logging.getLogger(__name__)) in each module.
  • Replace every print() call with an appropriate logger.debug/info/warning/error() call.
  • Configure the root logger in the application entrypoint to emit JSON or structured text format (include timestamp, level, module).
  • Ensure log level is configurable via LOG_LEVEL environment variable.

Acceptance criteria

  • No print() calls remain in the three listed modules.
  • Running the API with LOG_LEVEL=DEBUG produces structured log output.
  • Running with LOG_LEVEL=WARNING suppresses debug/info messages.
## Context `analyzer.py`, `serp_api.py`, and `llm.py` use bare `print()` statements. This makes it impossible to filter by log level, redirect output, or apply consistent formatting in production. Roadmap reference: ROADMAP.md > P2 > Backend > Add structured logging ## What to do - Create a shared logger (e.g. `logging.getLogger(__name__)`) in each module. - Replace every `print()` call with an appropriate `logger.debug/info/warning/error()` call. - Configure the root logger in the application entrypoint to emit JSON or structured text format (include timestamp, level, module). - Ensure log level is configurable via `LOG_LEVEL` environment variable. ## Acceptance criteria - No `print()` calls remain in the three listed modules. - Running the API with `LOG_LEVEL=DEBUG` produces structured log output. - Running with `LOG_LEVEL=WARNING` suppresses debug/info messages.
AI-Manager added the P2agent-readysmall labels 2026-03-27 05:23:05 +00:00
Author
Owner

This issue has already been resolved in the current codebase.

All three modules (analyzer.py, serp_api.py, llm.py) use logging.getLogger(__name__) with a centralized logging.basicConfig() configuration in config.py. No bare print() calls remain in these modules.

Closing as already implemented.

This issue has already been resolved in the current codebase. All three modules (`analyzer.py`, `serp_api.py`, `llm.py`) use `logging.getLogger(__name__)` with a centralized `logging.basicConfig()` configuration in `config.py`. No bare `print()` calls remain in these modules. Closing as already implemented.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#209