|
|
@@ -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--------------------------------"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|