浏览代码

1、网日志长度的输出

tags/0.0.1
PH2 4 年前
父节点
当前提交
6548762c4c
共有 1 个文件被更改,包括 8 次插入8 次删除
  1. +8
    -8
      lib/util/log/let_log.dart

+ 8
- 8
lib/util/log/let_log.dart 查看文件

@@ -3,6 +3,7 @@ library let_log;
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'dart:developer';
part 'log_widget.dart';
part 'net_widget.dart';

@@ -186,18 +187,19 @@ class _Log {
}

static void add(_Type type, Object value, Object detail) {
final log = _Log(
final logUtil = _Log(
type: type,
message: value?.toString(),
detail: detail?.toString(),
start: DateTime.now(),
);
list.add(log);
list.add(logUtil);
_clearWhenTooMuch();
length.value++;
if (Logger.config.printLog) {
debugPrint(
"${log.typeName} ${log.message}${log.detail == null ? '' : '\n${log.detail}'}\n--------------------------------");
// debugPrint(
// "${logUtil.typeName} ${logUtil.message}${logUtil.detail == null ? '' : '\n${logUtil.detail}'}\n--------------------------------");
log("\n${logUtil.typeName} ${logUtil.message}${logUtil.detail == null ? '' : '\n${logUtil.detail}'}\n--------------------------------");
}
}

@@ -318,8 +320,7 @@ class _Net extends ChangeNotifier {
_clearWhenTooMuch();
length.value++;
if (Logger.config.printNet) {
debugPrint(
"${_printNames[4]} ${type == null ? '' : '$type: '}${net.api}${net.req == null ? '' : '\n${_printNames[0]} 请求数据: ${net.req}'}\n--------------------------------");
log("\n${_printNames[4]} ${type == null ? '' : '$type: '}${net.api}${net.req == null ? '' : '\n${_printNames[0]} 请求数据: ${net.req}'}\n--------------------------------");
}
}

@@ -349,8 +350,7 @@ class _Net extends ChangeNotifier {
length.value++;
}
if (Logger.config.printNet) {
debugPrint(
"${_printNames[5]} ${net.type == null ? '' : '${net.type}: '}${net.api}${net.res == null ? '' : '\n${_printNames[0]} 响应数据: ${net.res}'}\nSpend: ${net.spend} ms\n--------------------------------");
log("\n${_printNames[5]} ${net.type == null ? '' : '${net.type}: '}${net.api}${net.res == null ? '' : '\n${_printNames[0]} 响应数据: ${net.res}'}\nSpend: ${net.spend} ms\n--------------------------------");
}
}



正在加载...
取消
保存