forked from
nekomimi.pet/wisp.place-monorepo
Monorepo for Wisp.place. A static site hosting service built on top of the AT Protocol.
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 // Safe error logging - sanitizes in production
18 error: (message: string, error?: any) => {
19 if (isDev) {
20 // Development: log full error details
21 console.error(message, error);
22 } else {
23 // Production: log only the message, not error details
24 console.error(message);
25 }
26 },
27
28 // Log error with context but sanitize sensitive data in production
29 errorWithContext: (message: string, context?: Record<string, any>, error?: any) => {
30 if (isDev) {
31 console.error(message, context, error);
32 } else {
33 // In production, only log the message
34 console.error(message);
35 }
36 }
37};