(self, entry: dict[str, Any])
| 260 | } |
| 261 | |
| 262 | def _write_entry(self, entry: dict[str, Any]) -> None: |
| 263 | date_part = str(entry.get("date") or datetime.now().strftime("%Y-%m-%d")) |
| 264 | payload = json.dumps(entry, ensure_ascii=False, separators=(",", ":")) |
| 265 | with self._lock: |
| 266 | self._append_line(self.settings.runtime_logs_dir / f"events-{date_part}.jsonl", payload) |
| 267 | account_id = str(entry.get("account_id") or "").strip() |
| 268 | if account_id and account_id != "system": |
| 269 | account_dir = self.settings.runtime_logs_dir / "accounts" / account_id |
| 270 | account_dir.mkdir(parents=True, exist_ok=True) |
| 271 | self._append_line(account_dir / f"{date_part}.jsonl", payload) |
| 272 | |
| 273 | def _append_line(self, path: Path, line: str) -> None: |
| 274 | path.parent.mkdir(parents=True, exist_ok=True) |
no test coverage detected