日志初始配置添加自定义标签
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:EasyDartModule/base/logger/Logger.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:shelf/shelf.dart' as sf;
|
||||
@@ -41,8 +43,11 @@ class TraceDio {
|
||||
options.headers['X-Span-ID'] = spanId;
|
||||
}
|
||||
// 记录请求日志
|
||||
_logger?.info('发送请求: ${options.method} ${options.uri}',
|
||||
tag: "DIO", traceId: traceId, spanId: spanId);
|
||||
_logger?.info(
|
||||
'发送请求: ${options.method} ${options.uri} ${options.data != null ? jsonEncode(options.data) : ""}',
|
||||
tag: "DIO",
|
||||
traceId: traceId,
|
||||
spanId: spanId);
|
||||
return handler.next(options); // 继续请求
|
||||
},
|
||||
onResponse: (response, handler) {
|
||||
|
||||
Reference in New Issue
Block a user