Foundation (phase 01, verified): - FastAPI app: /api/health, /api/suggestions, /api/chat (placeholder), static frontend served locally (no CDN) - Postgres 17 + pgvector via db/Containerfile + compose.yaml (podman compose up -d db), Alembic initial migration (documents, chunks with vector(768), query_log) - LLM client targeting https://aipi.reeseapps.com/v1 (turbo/embed); scripts/llm_probe.py verified models + 768-dim embeddings live - Conditional debugpy: imported only when DEBUGPY=1 (attach on demand, :5678); logging config for clean single-line logs - Frontend shell: mobile-first chat + Sources pages, tokens, a11y baselines - Tests: 24 unit+integration (99% coverage on app/), ruff + pyright clean, Playwright smoke E2E (3 tests) against a deterministic mock LLM - Planning: .agent/PLAN.md (architecture + LOCKED decisions), AGENTS.md, 6 user stories, 7 phase files (one story / one phase / one Playwright suite each)
27 lines
935 B
Python
27 lines
935 B
Python
"""Logging configuration.
|
|
|
|
Human-readable, timestamped, single-line records on stdout. Every
|
|
request-critical operation (retrieval, LLM calls, imports) logs key=value
|
|
context at INFO level so a user is never left wondering what the system is
|
|
doing — this pairs with the UI's loading/progress feedback (see PLAN §UI/UX).
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import logging
|
|
import sys
|
|
|
|
_FORMAT = "%(asctime)s %(levelname)-8s %(name)s :: %(message)s"
|
|
_DATEFMT = "%Y-%m-%d %H:%M:%S"
|
|
|
|
|
|
def configure_logging(level: str = "INFO") -> None:
|
|
root = logging.getLogger()
|
|
root.setLevel(level.upper())
|
|
handler = logging.StreamHandler(sys.stdout)
|
|
handler.setFormatter(logging.Formatter(_FORMAT, _DATEFMT))
|
|
root.handlers = [handler]
|
|
|
|
# Keep third-party noise down while our own loggers stay verbose.
|
|
for noisy in ("httpx", "httpcore", "openai", "urllib3"):
|
|
logging.getLogger(noisy).setLevel(logging.WARNING)
|