Spaces:
Running
Running
Download utils/audit.py from Success-dev/venthrive-api: direct link, hf CLI and curl.
- Browser
- Download file 582 Bytes
-
https://huggingface.co/spaces/Success-dev/venthrive-api/resolve/main/utils/audit.py
- Command line
-
hf download hf://spaces/Success-dev/venthrive-api/utils/audit.py
-
curl -L -o audit.py https://huggingface.co/spaces/Success-dev/venthrive-api/resolve/main/utils/audit.py
582 Bytes
| """ | |
| 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}") | |