fix: 去除非前端操作记录操作日志
This commit is contained in:
@@ -34,6 +34,13 @@ func LogOperate(options collectlogs.Options) func(http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
startTime := time.Now()
|
||||
|
||||
// 只对前端发送的数据进行记录
|
||||
appCodeStr := r.Header.Get("X-App-Code")
|
||||
if appCodeStr == "" {
|
||||
next.ServeHTTP(w, r)
|
||||
return
|
||||
}
|
||||
|
||||
// 函数名
|
||||
funcName := runtime.FuncForPC(reflect.ValueOf(next).Pointer()).Name()
|
||||
lastDotIndex := strings.LastIndex(funcName, "/")
|
||||
|
||||
Reference in New Issue
Block a user