Spaces:
Build error
Build error
| # telemetry.py | |
| import json | |
| import os | |
| from datetime import datetime | |
| LOG_FILE = "telemetry_log.jsonl" | |
| def log_event(agent_id, action, status, metadata=None): | |
| """Logs each agent event with timestamp and context.""" | |
| event = { | |
| "timestamp": datetime.utcnow().isoformat(), | |
| "agent_id": agent_id, | |
| "action": action, | |
| "status": status, | |
| "metadata": metadata or {} | |
| } | |
| # Write to local JSONL file (can be replaced with Supabase later) | |
| with open(LOG_FILE, "a") as f: | |
| f.write(json.dumps(event) + "\n") | |
| print(f"[Telemetry] Logged: {action} - {status}") |