forked from 0xWheatyz/SPARC
Replace print() calls with structured logging in analyzer.py, serp_api.py, and llm.py #1200
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?
Context
analyzer.py,serp_api.py, andllm.pyuseprint()for diagnostic output. This means log levels cannot be filtered, output format is inconsistent, and structured log aggregators (e.g., Loki) cannot parse the messages.Roadmap reference: ROADMAP.md > P2 > Backend > Add structured logging
What to do
loggingconfiguration module (or use FastAPI lifespan) to initialize the root logger with a consistent format (e.g., JSON in production, human-readable in development).print()call inanalyzer.py,serp_api.py, andllm.pywith appropriatelogger.debug(),logger.info(),logger.warning(), orlogger.error()calls.LOG_LEVELenvironment variable (defaultINFO) to control verbosity.Acceptance criteria
print()calls remain in the three target modules.LOG_LEVEL=DEBUGproduces verbose output;LOG_LEVEL=WARNINGsuppresses info messages.This issue has been resolved on main. No
print()calls remain inSPARC/analyzer.py,SPARC/serp_api.py, orSPARC/llm.py. All modules use theloggingmodule withlogger = logging.getLogger(__name__). Closing as complete.