Spaces:
Running
Running
File size: 582 Bytes
a32af27 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | """
Writes to the admin audit trail (backend/sql/admin_audit_schema.sql). Never
raises — a failed audit write must not break the action it's recording.
"""
from utils.supabase_client import get_supabase
def log_action(actor: str, kind: str, action: str, summary: str, target: str | None = None) -> None:
try:
get_supabase().table("admin_audit_log").insert({
"actor": actor, "kind": kind, "action": action, "target": target, "summary": summary,
}).execute()
except Exception as e:
print(f"[audit] failed to log {kind}/{action}: {e}")
|