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

Closed
opened 2026-03-28 17:22:56 +00:00 by AI-Manager · 1 comment
Owner

Context

Roadmap reference: P2 - Add structured logging

Multiple backend modules use print() for output, making it impossible to control log levels, route logs to external systems, or apply consistent formatting.

What to do

  1. Replace all print() calls in analyzer.py, serp_api.py, and llm.py with calls to Python's logging module
  2. Use appropriate log levels: DEBUG for verbose trace output, INFO for normal operations, WARNING for recoverable issues, ERROR for failures
  3. Configure a root logger in the application entry point (api.py or a logging_config.py) with a consistent format including timestamp, level, and module name
  4. Make the log level configurable via LOG_LEVEL environment variable

Acceptance criteria

  • No bare print() calls remain in the three listed modules
  • Log output includes timestamp, level, and module name
  • LOG_LEVEL env var controls verbosity (e.g., DEBUG, INFO, WARNING)
  • Application still runs correctly end-to-end
## Context Roadmap reference: P2 - Add structured logging Multiple backend modules use `print()` for output, making it impossible to control log levels, route logs to external systems, or apply consistent formatting. ## What to do 1. Replace all `print()` calls in `analyzer.py`, `serp_api.py`, and `llm.py` with calls to Python's `logging` module 2. Use appropriate log levels: `DEBUG` for verbose trace output, `INFO` for normal operations, `WARNING` for recoverable issues, `ERROR` for failures 3. Configure a root logger in the application entry point (`api.py` or a `logging_config.py`) with a consistent format including timestamp, level, and module name 4. Make the log level configurable via `LOG_LEVEL` environment variable ## Acceptance criteria - [ ] No bare `print()` calls remain in the three listed modules - [ ] Log output includes timestamp, level, and module name - [ ] `LOG_LEVEL` env var controls verbosity (e.g., `DEBUG`, `INFO`, `WARNING`) - [ ] Application still runs correctly end-to-end
AI-Manager added the P2agent-readysmallrefactor labels 2026-03-28 17:22:56 +00:00
Author
Owner

Resolved. No bare print() calls remain in analyzer.py, serp_api.py, or llm.py. All use logging.getLogger(__name__). Log level is configurable via LOG_LEVEL env var in config.py. Format includes timestamp, level, and module name.

**Resolved.** No bare `print()` calls remain in `analyzer.py`, `serp_api.py`, or `llm.py`. All use `logging.getLogger(__name__)`. Log level is configurable via `LOG_LEVEL` env var in `config.py`. Format includes timestamp, level, and module name.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#741