feat(lps): 인터넷 최저가 검색 솔루션 프레임워크 골격 추가
backend 와 동일한 프레임워크로 lps/ 폴더를 신설한다. 구체적인 도메인 로직(크롤링/오픈API/최저가 산정)은 미정이라 골격만 구성한다. - FastAPI 부트스트랩(web_main/router) + lifespan·CORS·gzip·로그 미들웨어 + /healthz - TOML 설정 로더(APP_ENV) + pydantic config + DB env override - DB 세션 매니저(논리 DB × R/W, service→람다 위임) — 엔진 lazy 라 DB 없이도 부팅 - 공통 응답 규약(gmodel) + ErrorType/DBType/DBWRType - router→services→crud 계층 컨벤션(services/crud 는 빈 폴더로 자리만) - 포트 9400(backend 9300·agent 9500 회피), Dockerfile/run_local_server.sh/README - tests/test_health.py 스모크(healthz, DB 없이 통과) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
235863aea9
commit
11a7be7154
24 files changed
+885
No files matched your search
@@ -0,0 +1,43 @@
|
||||
import sys
|
||||
import traceback
|
||||
from datetime import datetime, timezone
|
||||
|
||||
|
||||
class _Logger:
|
||||
"""원본 DerbyServer LOG 인터페이스를 간소화한 버전.
|
||||
LOG.i / LOG.d / LOG.w / LOG.e_no_callstack / LOG.SetPrefix 를 제공한다.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
self._prefix = ""
|
||||
|
||||
def SetPrefix(self, prefix: str):
|
||||
self._prefix = prefix
|
||||
|
||||
def _now(self) -> str:
|
||||
return datetime.now(timezone.utc).strftime("%Y-%m-%d %H:%M:%S")
|
||||
|
||||
def _write(self, level: str, msg):
|
||||
head = f"{self._now()} [{level}]"
|
||||
if self._prefix:
|
||||
head += f"[{self._prefix}]"
|
||||
print(f"{head} {msg}", file=sys.stderr if level in ("WARN", "ERROR") else sys.stdout)
|
||||
|
||||
def d(self, msg):
|
||||
self._write("DEBUG", msg)
|
||||
|
||||
def i(self, msg):
|
||||
self._write("INFO", msg)
|
||||
|
||||
def w(self, msg):
|
||||
self._write("WARN", msg)
|
||||
|
||||
def e(self, msg):
|
||||
self._write("ERROR", msg)
|
||||
traceback.print_stack()
|
||||
|
||||
def e_no_callstack(self, msg):
|
||||
self._write("ERROR", msg)
|
||||
|
||||
|
||||
LOG = _Logger()
|
||||
Reference in new issue
Block a user