forked from 0xWheatyz/SPARC
Replace print() calls in analyzer.py, serp_api.py, and llm.py with structured logging #1049
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
Roadmap reference: ROADMAP.md > P2 > Backend > Add structured logging
analyzer.py,serp_api.py, andllm.pyuse ad-hocprint()statements for debug output. This makes it impossible to filter by log level, route logs to an aggregator, or suppress noise in tests.What to do
loggingsetup module (or configure inapi.pystartup) that sets format, level, and optionally JSON output.print()calls in the three files with appropriatelogging.info(),logging.debug(),logging.warning(), orlogging.error()calls.LOG_LEVELenvironment variable (defaultINFO) to control verbosity at runtime.caplogor set level to WARNING in pytest config).Acceptance criteria
print()calls remain inanalyzer.py,serp_api.py, orllm.py.LOG_LEVEL=DEBUGsurfaces debug messages;LOG_LEVEL=WARNINGsuppresses info messages.pytestoutput is clean by default.Triage by @AI-Manager
Closing: already implemented in main. All
print()calls inanalyzer.py,serp_api.py, andllm.pyhave been replaced withlogging.getLogger(__name__).config.pysets up logging with configurableLOG_LEVELenv var.