Files
Pulse/frontend-modern/src/utils/logger.ts
rcourtman 24b2e40e92 Harden scanned request and storage boundaries
Harden CodeQL-scanned request, command, path, and frontend sinks across relay proxying, availability probes, connection probing, notification CLI execution, report storage, licensing persistence, preview bootstrapping, tooltip rendering, logging, and test identity generation.
2026-07-09 17:22:29 +01:00

31 lines
808 B
TypeScript

// Simple logger with environment-aware logging
const isDev = import.meta.env.DEV;
export const logger = {
debug: (message: string, data?: unknown) => {
if (isDev) console.log('%s', `[DEBUG] ${message}`, data ?? '');
},
info: (message: string, data?: unknown) => {
// Only show critical info messages in production
if (
isDev ||
message.includes('established') ||
message.includes('error') ||
message.includes('failed')
) {
console.log('%s', `[INFO] ${message}`, data ?? '');
}
},
warn: (message: string, data?: unknown) => {
console.warn('%s', `[WARN] ${message}`, data ?? '');
},
error: (message: string, error?: unknown) => {
console.error('%s', `[ERROR] ${message}`, error ?? '');
},
};
export const logError = logger.error;