diff --git a/src/lib/logger.ts b/src/lib/logger.ts index 3ca7756..5c1f59e 100644 --- a/src/lib/logger.ts +++ b/src/lib/logger.ts @@ -11,11 +11,18 @@ export async function logAction( if (!user) return - await supabase.from('audit_logs').insert({ - user_id: user.id, - action, - entity_type: entityType, - entity_id: entityId, - details, - }) + try { + const { error } = await supabase.from('audit_logs').insert({ + user_id: user.id, + action, + entity_type: entityType, + entity_id: entityId, + details, + }) + if (error) { + console.error("Audit log error:", error) + } + } catch (err) { + console.error("Audit log exception:", err) + } }