Browse Source

wip:删除打印链接日志

wangkaiyue 2 năm trước cách đây
mục cha
commit
5b0e67e6c7
1 tập tin đã thay đổi với 3 bổ sung1 xóa
  1. 3 1
      internal/service/middle.go

+ 3 - 1
internal/service/middle.go

@@ -28,7 +28,9 @@ func Middleware(r *ghttp.Request) {
 	queryLevel := getQueryLevel(bodyBytes)
 	r.SetCtxVar(consts.QueryLevelKey, queryLevel)
 	r.Middleware.Next()
-	g.Log().Infof(r.Context(), "status:%d  time:%fs  waitPool:%fs  level:%d  from:%s  query:%s", r.Response.Status, time.Since(now).Seconds(), r.GetCtxVar(consts.QueryWaitPoolTime).Float64(), queryLevel, r.GetClientIp(), string(bodyBytes))
+	if r.RequestURI != "/" { //打印非建立链接的日志
+		g.Log().Infof(r.Context(), "status:%d  time:%fs  req:%s   waitPool:%fs  level:%d  from:%s  query:%s", r.Response.Status, time.Since(now).Seconds(), r.RequestURI, r.GetCtxVar(consts.QueryWaitPoolTime).Float64(), queryLevel, r.GetClientIp(), string(bodyBytes))
+	}
 }
 
 var (