import { createConsola } from 'consola';

/**
 * Universal logger for @djangocfg/api/auth
 * Uses consola for beautiful console logging
 *
 * Log levels:
 * - 0: silent
 * - 1: fatal, error
 * - 2: warn
 * - 3: log, info
 * - 4: debug
 * - 5: trace, verbose
 */
const isDevelopment = process.env.NODE_ENV === 'development';
const isStaticBuild = process.env.NEXT_PUBLIC_STATIC_BUILD === 'true';
const showLogs = isDevelopment || isStaticBuild;

export const logger = createConsola({
  level: showLogs ? 4 : 1,  // dev: debug, production: errors only
}).withTag('api');

/**
 * Auth-specific logger
 */
export const authLogger = logger.withTag('auth');

export default logger;
