mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-21 11:31:13 -05:00
Refactor: Update Supabase client
This commit is contained in:
@@ -6,11 +6,33 @@
|
||||
type LogLevel = 'info' | 'warn' | 'error' | 'debug';
|
||||
|
||||
interface LogContext {
|
||||
requestId?: string; // Correlation ID for tracing
|
||||
userId?: string;
|
||||
action?: string;
|
||||
duration?: number; // Request duration in ms
|
||||
traceId?: string; // Distributed tracing ID
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
// Request tracking utilities
|
||||
export interface RequestTracking {
|
||||
requestId: string;
|
||||
start: number;
|
||||
traceId?: string;
|
||||
}
|
||||
|
||||
export function startRequest(traceId?: string): RequestTracking {
|
||||
return {
|
||||
requestId: crypto.randomUUID(),
|
||||
start: Date.now(),
|
||||
traceId: traceId || crypto.randomUUID(),
|
||||
};
|
||||
}
|
||||
|
||||
export function endRequest(tracking: RequestTracking): number {
|
||||
return Date.now() - tracking.start;
|
||||
}
|
||||
|
||||
// Fields that should never be logged
|
||||
const SENSITIVE_FIELDS = [
|
||||
'password',
|
||||
|
||||
Reference in New Issue
Block a user