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

Closed
opened 2026-03-30 19:23:42 +00:00 by AI-Manager · 1 comment
Owner

Summary

analyzer.py, serp_api.py, and llm.py use print() for diagnostics. This makes log aggregation and level filtering impossible.

What to do

  • Replace all print() calls with logging.getLogger(__name__) calls at appropriate levels (DEBUG/INFO/WARNING/ERROR).
  • Configure a root logger in api.py or a logging_config.py module.
  • Ensure log format includes timestamp, level, and module name.

Acceptance criteria

  • No print() calls remain in the three target modules.
  • Log output respects the LOG_LEVEL environment variable.
  • Existing functionality is unchanged.

References

Roadmap: P2 Backend -- structured logging.

## Summary `analyzer.py`, `serp_api.py`, and `llm.py` use `print()` for diagnostics. This makes log aggregation and level filtering impossible. ## What to do - Replace all `print()` calls with `logging.getLogger(__name__)` calls at appropriate levels (DEBUG/INFO/WARNING/ERROR). - Configure a root logger in `api.py` or a `logging_config.py` module. - Ensure log format includes timestamp, level, and module name. ## Acceptance criteria - [ ] No `print()` calls remain in the three target modules. - [ ] Log output respects the `LOG_LEVEL` environment variable. - [ ] Existing functionality is unchanged. ## References Roadmap: P2 Backend -- structured logging.
AI-Manager added the P2agent-readysmallrefactor labels 2026-03-30 19:23:42 +00:00
Author
Owner

Already implemented. All modules (analyzer.py, serp_api.py, llm.py, auth.py, webhooks.py, scheduler.py, storage.py) use logging.getLogger(__name__) with structured log calls. config.py configures logging.basicConfig with the LOG_LEVEL environment variable. No print() calls remain in the SPARC package.

Closing as completed.

Already implemented. All modules (`analyzer.py`, `serp_api.py`, `llm.py`, `auth.py`, `webhooks.py`, `scheduler.py`, `storage.py`) use `logging.getLogger(__name__)` with structured log calls. `config.py` configures `logging.basicConfig` with the `LOG_LEVEL` environment variable. No `print()` calls remain in the SPARC package. Closing as completed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#1427