forked from 0xWheatyz/SPARC
Replace print() calls with structured Python logging in analyzer.py, serp_api.py, and llm.py #1101
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Background
Several backend modules use
print()for diagnostic output. This prevents operators from controlling log verbosity, routing logs to structured sinks (e.g., Loki), or filtering by severity.What to do
loggingconfiguration inconfig.pyor a dedicatedlog.pymodule that sets up a root logger with a JSON or text formatter and honours aLOG_LEVELenvironment variable (defaultINFO).print()call inanalyzer.py,serp_api.py, andllm.pywith the appropriatelogger.debug(),logger.info(),logger.warning(), orlogger.error()call.logger.exception()where currently bareprint(e)is used.Acceptance criteria
grep -r "print(" analyzer.py serp_api.py llm.pyreturns no matches.LOG_LEVEL=DEBUGcauses verbose output;LOG_LEVEL=WARNINGsuppresses info messages.pytestcontinues to pass (logging should not break tests).Roadmap reference: P2 - Backend - Add structured logging
This issue has been verified as already implemented in the current codebase. The acceptance criteria are met based on code review. Closing as completed.