getFullLogStringForWhiteScreen static method

DangerousLogModel getFullLogStringForWhiteScreen({
  1. int? logMaxCount,
})

Implementation

static DangerousLogModel getFullLogStringForWhiteScreen({
  int? logMaxCount, // 只取最后几条日志,>0时候才有效,其他默认全取
}) {
  List<LogModel> logModels = DevLogUtil.logModels;

  // 1、获取日志原始数据
  List<LogModel> resultLogModels = _getLogModelsForWhiteScreen(
    logModels,
    logMaxCount: logMaxCount,
  );

  // 2、获取日志简洁信息
  String fullResultLogString = getFullLogString(resultLogModels);

  // title
  LogModel resultLogModel = resultLogModels.last;
  String resultLogString = resultLogModel.shortMapString;
  String logTitle =
      resultLogString.substring(0, min(12, resultLogString.length));

  return DangerousLogModel(title: logTitle, content: fullResultLogString);
}