Files
bitwarden-desktop-agent/log.py

26 lines
426 B
Python
Raw Normal View History

2026-03-18 17:47:10 +09:00
import sys
import time
_start = time.monotonic()
2026-03-19 12:42:29 +09:00
2026-03-18 17:47:10 +09:00
def _ts() -> str:
2026-03-19 12:42:29 +09:00
return f"{time.monotonic() - _start:8.3f}"
2026-03-18 17:47:10 +09:00
def info(msg: str):
print(f"[{_ts()}] {msg}", file=sys.stderr, flush=True)
2026-03-19 12:42:29 +09:00
2026-03-18 17:47:10 +09:00
def warn(msg: str):
print(f"[{_ts()}] WARN {msg}", file=sys.stderr, flush=True)
2026-03-19 12:42:29 +09:00
2026-03-18 17:47:10 +09:00
def error(msg: str):
print(f"[{_ts()}] ERROR {msg}", file=sys.stderr, flush=True)
2026-03-19 12:42:29 +09:00
2026-03-18 17:47:10 +09:00
def fatal(msg: str):
error(msg)
sys.exit(1)