import pino from 'pino';
import { env } from '../../config/env.js';

export const logger = pino({
  level: env.LOG_LEVEL,
  // 修复：pino 默认字段选项为 `base`，而非 `defaultFields`
  base: {
    service: 'classes',
    version: '0.1.0',
  },
  transport:
    env.NODE_ENV === 'development'
      ? {
          target: 'pino-pretty',
          options: { colorize: true },
        }
      : undefined,
});

export type Logger = typeof logger;
