瀏覽代碼

fix: fix switch doesn't work bug (#2183)

benqi 2 年之前
父節點
當前提交
edbf1a3b63
共有 1 個文件被更改,包括 9 次插入9 次删除
  1. 9 9
      zrpc/internal/serverinterceptors/statinterceptor.go

+ 9 - 9
zrpc/internal/serverinterceptors/statinterceptor.go

@@ -64,15 +64,15 @@ func logDuration(ctx context.Context, method string, req interface{}, duration t
 		} else {
 		} else {
 			logger.Infof("%s - %s - %s", addr, method)
 			logger.Infof("%s - %s - %s", addr, method)
 		}
 		}
-	}
-
-	content, err := json.Marshal(req)
-	if err != nil {
-		logx.WithContext(ctx).Errorf("%s - %s", addr, err.Error())
-	} else if duration > slowThreshold.Load() {
-		logger.Slowf("[RPC] slowcall - %s - %s - %s",
-			addr, method, string(content))
 	} else {
 	} else {
-		logger.Infof("%s - %s - %s", addr, method, string(content))
+		content, err := json.Marshal(req)
+		if err != nil {
+			logx.WithContext(ctx).Errorf("%s - %s", addr, err.Error())
+		} else if duration > slowThreshold.Load() {
+			logger.Slowf("[RPC] slowcall - %s - %s - %s",
+				addr, method, string(content))
+		} else {
+			logger.Infof("%s - %s - %s", addr, method, string(content))
+		}
 	}
 	}
 }
 }