Junhoee's picture
Upload 98 files
f646e0b verified
Raw
History Blame Contribute Delete
675 Bytes
"""ํ„ด ๋กœ๊ทธ ์ €์žฅ โ€” ์—ฐ๊ตฌ ๋ฐ์ดํ„ฐ ๊ฒธ์šฉ, ์‚ญ์ œ ๊ธˆ์ง€ (CLAUDE.md).
MVP: ๋กœ์ปฌ jsonl ๋ฐฑ์—”๋“œ. ์Šคํ‚ค๋งˆ๋Š” 2๋‹จ๊ณ„ ๊ทธ๋ž˜ํ”„ํ™”๋ฅผ ์—ผ๋‘์— ๋‘” ํ‰๋ฉด ๋ ˆ์ฝ”๋“œ.
"""
from __future__ import annotations
import json
import time
from pathlib import Path
class PlaylogRepository:
def __init__(self, path: str | Path = "logs/playlog.jsonl"):
self.path = Path(path)
self.path.parent.mkdir(parents=True, exist_ok=True)
def append(self, record: dict) -> None:
record = {"ts": round(time.time(), 3), **record}
with self.path.open("a", encoding="utf-8") as f:
f.write(json.dumps(record, ensure_ascii=False) + "\n")