Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

808 B
Raw Blame
// 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;