Open lukas-pierce opened 2 months ago
这个可以通过自己过滤一下就行了
/// 添加日志拦截器
dio.interceptors.add(PrettyDioLogger(
requestHeader: true,
requestBody: true,
responseBody: true,
responseHeader: false,
error: true,
compact: true,
enabled: kDebugMode,
filter: (options, args) {
if (options.extra['prettyLog'] == true) return true;
return false;
},
));
@chenjiangmin Yes, you specified it only for filtering. But I would also like to customize the logging parameters at the extra options level. See myApiMethod2
and myApiMethod3
in my example
I use a logger inside my api class, and when I enable it, too much unnecessary information gets into the console
I know that it is possible to filter requests using the
filter
function, but it is difficult to write a condition every time to debug a new requestBut it would be great to add the ability to specify for a specific request whether it should be logged or not using the extra option
And you could also add the ability to overwrite the default config for a specific request
The concept could ultimately look like this: