Improvements and fixes

This commit is contained in:
2026-03-19 12:42:29 +09:00
parent 891b1941bd
commit 4e0ee51a33
14 changed files with 420 additions and 225 deletions

8
log.py
View File

@@ -3,19 +3,23 @@ import time
_start = time.monotonic()
def _ts() -> str:
elapsed = time.monotonic() - _start
return f"{elapsed:8.3f}"
return f"{time.monotonic() - _start:8.3f}"
def info(msg: str):
print(f"[{_ts()}] {msg}", file=sys.stderr, flush=True)
def warn(msg: str):
print(f"[{_ts()}] WARN {msg}", file=sys.stderr, flush=True)
def error(msg: str):
print(f"[{_ts()}] ERROR {msg}", file=sys.stderr, flush=True)
def fatal(msg: str):
error(msg)
sys.exit(1)