Monorepo for wisp.place. A static site hosting service built on top of the AT Protocol. wisp.place
1// Secure logging utility - only verbose in development mode 2const isDev = process.env.NODE_ENV !== 'production'; 3 4export const logger = { 5 // Always log these (safe for production) 6 info: (...args: any[]) => { 7 console.log(...args); 8 }, 9 10 // Only log in development (may contain sensitive info) 11 debug: (...args: any[]) => { 12 if (isDev) { 13 console.debug(...args); 14 } 15 }, 16 17 // Warning logging (always logged but may be sanitized in production) 18 warn: (message: string, context?: Record<string, any>) => { 19 if (isDev) { 20 console.warn(message, context); 21 } else { 22 console.warn(message); 23 } 24 }, 25 26 // Safe error logging - sanitizes in production 27 error: (message: string, error?: any) => { 28 if (isDev) { 29 // Development: log full error details 30 console.error(message, error); 31 } else { 32 // Production: log only the message, not error details 33 console.error(message); 34 } 35 }, 36 37 // Log error with context but sanitize sensitive data in production 38 errorWithContext: (message: string, context?: Record<string, any>, error?: any) => { 39 if (isDev) { 40 console.error(message, context, error); 41 } else { 42 // In production, only log the message 43 console.error(message); 44 } 45 } 46};