Added replay ability

This commit is contained in:
2026-10-10 23:00:04 -06:00
parent 13b1dcdd97
commit fbfa90edec
16 changed files with 700 additions and 39 deletions
+13 -1
View File
@@ -4,7 +4,7 @@ import threading
from datetime import datetime, timezone
from typing import Any, Dict, List
from ..environment import discovery_log_path
from ..environment import discovery_log_path, replay_path
from . import items as itemdb
@@ -16,11 +16,23 @@ def enabled() -> bool:
return bool(discovery_log_path())
def _same_file(a: str, b: str) -> bool:
try:
return os.path.abspath(a) == os.path.abspath(b)
except (TypeError, ValueError):
return False
def log(record_type: str, **fields):
path = discovery_log_path()
if not path:
return
# Never clobber the log we are replaying from.
source = replay_path()
if source and _same_file(path, source):
return
global _initialized
with _lock:
log_dir = os.path.dirname(path)