Something went wrong. Try again.
Monorepo for wisp.place. A static site hosting service built on top of the AT Protocol. forked from nekomimi.pet/wisp.place-monorepo
Something went wrong. Try again.
1.4 kB · 46 lines
TypeScript
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647// Secure logging utility - only verbose in development modeconst isDev = process.env.NODE_ENV !== 'production';
export const logger = { // Always log these (safe for production) info: (...args: any[]) => { console.log(...args); },
// Only log in development (may contain sensitive info) debug: (...args: any[]) => { if (isDev) { console.debug(...args); } },
// Warning logging (always logged but may be sanitized in production) warn: (message: string, context?: Record<string, any>) => { if (isDev) { console.warn(message, context); } else { console.warn(message); } },
// Safe error logging - sanitizes in production error: (message: string, error?: any) => { if (isDev) { // Development: log full error details console.error(message, error); } else { // Production: log only the message, not error details console.error(message); } },
// Log error with context but sanitize sensitive data in production errorWithContext: (message: string, context?: Record<string, any>, error?: any) => { if (isDev) { console.error(message, context, error); } else { // In production, only log the message console.error(message); } }};