Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

891 B
Raw Blame
/**
 * Dev-gated logger utility.
 *
 * In production builds, `debug` and `info` are no-ops (tree-shaken by Vite).
 * `warn` and `error` always log - they indicate real issues.
 *
 * Usage:
 *   import { logger } from '@/utils/logger';
 *   logger.debug('[Tag]', 'message');
 *   logger.info('[Tag]', 'message');
 *   logger.warn('[Tag]', 'message');
 *   logger.error('[Tag]', 'message', err);
 */

const IS_DEV = import.meta.env.DEV;

function noop(..._args: unknown[]): void {
  // intentionally empty - stripped in production
}

export const logger = {
  /** Verbose debug output - dev only */
  debug: IS_DEV ? console.debug.bind(console) : noop,

  /** Informational - dev only */
  info: IS_DEV ? console.log.bind(console) : noop,

  /** Warnings - always logged */
  warn: console.warn.bind(console),

  /** Errors - always logged */
  error: console.error.bind(console),
} as const;