mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-12-02 18:19:07 +01:00
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.
31 lines
808 B
TypeScript
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;
|