From b37ded8080245b5087211c997f118df08e183d78 Mon Sep 17 00:00:00 2001 From: laiiihz Date: Mon, 8 Feb 2021 16:29:22 +0800 Subject: [PATCH] update logger --- lib/provider/app_provider.dart | 2 ++ lib/utils/network/net_util.dart | 17 ----------------- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/lib/provider/app_provider.dart b/lib/provider/app_provider.dart index 6f7617e2..99e86cb6 100644 --- a/lib/provider/app_provider.dart +++ b/lib/provider/app_provider.dart @@ -11,6 +11,7 @@ import 'package:akuCommunity/model/community/hot_topic_model.dart'; import 'package:akuCommunity/utils/hive_store.dart'; import 'package:akuCommunity/utils/network/base_model.dart'; import 'package:akuCommunity/utils/network/net_util.dart'; +import 'package:power_logger/power_logger.dart'; class AppProvider extends ChangeNotifier { ///初始值为 @@ -133,6 +134,7 @@ class AppProvider extends ChangeNotifier { Response response = await Dio().get( 'https://api.caiyunapp.com/v2.5/Rl2lmppO9q15q8W6/${_location.latLng.longitude},${_location.latLng.latitude}/realtime.json', ); + LoggerData.addData(response); _weatherModel = RealTimeWeatherModel.fromJson(response.data); notifyListeners(); } diff --git a/lib/utils/network/net_util.dart b/lib/utils/network/net_util.dart index 666cf01b..0c619574 100644 --- a/lib/utils/network/net_util.dart +++ b/lib/utils/network/net_util.dart @@ -19,7 +19,6 @@ import 'package:akuCommunity/utils/network/base_model.dart'; class NetUtil { Dio _dio; - Logger _logger; static final NetUtil _netUtil = NetUtil._internal(); factory NetUtil() => _netUtil; @@ -27,11 +26,6 @@ class NetUtil { Dio get dio => _dio; NetUtil._internal() { - _logger = Logger( - printer: PrettyPrinter( - methodCount: 2, - errorMethodCount: 4, - )); BaseOptions options = BaseOptions( baseUrl: API.baseURL, connectTimeout: API.networkTimeOut, @@ -43,12 +37,6 @@ class NetUtil { dio.interceptors.add(InterceptorsWrapper( onRequest: (RequestOptions options) async => options, onResponse: (Response response) async { - _logger.v({ - 'path': response.request.path, - 'header': response.request.headers, - 'params': response.request.queryParameters, - 'data': response.data, - }); LoggerData.addData(response); return response; }, @@ -61,7 +49,6 @@ class NetUtil { ///call auth after login auth(String token) { - _logger.d('setToken@$token'); _dio.options.headers.putIfAbsent('App-Admin-Token', () => token); } @@ -150,10 +137,6 @@ class NetUtil { } _parseErr(DioError err) { - _logger.v({ - 'type': err.type.toString(), - 'message': err.message, - }); LoggerData.addData(err); _makeToast(String message) { BotToast.showText(text: '$message\_${err?.response?.statusCode ?? ''}');