fadd
This commit is contained in:
@@ -327,6 +327,24 @@ func (e *ExternalServiceLogger) LogResponse(requestID, transactionID, apiCode st
|
||||
)
|
||||
}
|
||||
|
||||
// LogResponseWithBody 记录响应日志(含原始响应体)
|
||||
func (e *ExternalServiceLogger) LogResponseWithBody(requestID, transactionID, apiCode string, statusCode int, duration time.Duration, responseBody string) {
|
||||
logger := e.responseLogger
|
||||
if logger == nil {
|
||||
logger = e.logger
|
||||
}
|
||||
logger.Info(fmt.Sprintf("%s API响应", e.serviceName),
|
||||
zap.String("service", e.serviceName),
|
||||
zap.String("request_id", requestID),
|
||||
zap.String("transaction_id", transactionID),
|
||||
zap.String("api_code", apiCode),
|
||||
zap.Int("status_code", statusCode),
|
||||
zap.Duration("duration", duration),
|
||||
zap.String("response_body", responseBody),
|
||||
zap.String("timestamp", time.Now().Format(time.RFC3339)),
|
||||
)
|
||||
}
|
||||
|
||||
// LogResponseWithID 记录包含响应ID的响应日志
|
||||
func (e *ExternalServiceLogger) LogResponseWithID(requestID, transactionID, apiCode string, statusCode int, duration time.Duration, responseID string) {
|
||||
logger := e.responseLogger
|
||||
|
||||
Reference in New Issue
Block a user