import 'package:loggy/loggy.dart';

/// 日志工具类
class KRLogUtil {
  static final KRLogUtil _instance = KRLogUtil._internal();
  factory KRLogUtil() => _instance;
  KRLogUtil._internal();

  /// 初始化日志
  static void kr_init() {
    Loggy.initLoggy(
      logPrinter: PrettyPrinter(),
    );
  }

  /// 调试日志
  static void kr_d(String message, {String? tag}) {
    Loggy('${tag ?? 'KRLogUtil'}').debug(message);
  }

  /// 信息日志
  static void kr_i(String message, {String? tag}) {
    Loggy('${tag ?? 'KRLogUtil'}').info(message);
  }

  /// 警告日志
  static void kr_w(String message, {String? tag}) {
    Loggy('${tag ?? 'KRLogUtil'}').warning(message);
  }

  /// 错误日志
  static void kr_e(String message, {String? tag, Object? error, StackTrace? stackTrace}) {
    Loggy('${tag ?? 'KRLogUtil'}').error(message, error, stackTrace);
  }

  /// 网络日志
  static void kr_network(String message, {String? tag}) {
    Loggy('${tag ?? 'Network'}').info(message);
  }

  /// 性能日志
  static void kr_performance(String message, {String? tag}) {
    Loggy('${tag ?? 'Performance'}').info(message);
  }
} 