wangshan 3 жил өмнө
parent
commit
8dbf57aace
1 өөрчлөгдсөн 2 нэмэгдсэн , 2 устгасан
  1. 2 2
      common/mgosl.go

+ 2 - 2
common/mgosl.go

@@ -20,7 +20,7 @@ var (
 	saveLogsLock = &sync.Mutex{}
 )
 
-func AddMgoLogs(mgoLog mongodb.MongodbSim, r *http.Request, tableName string, ExcludeUrl []*regexp.Regexp) {
+func AddMgoLogs(mgoLog mongodb.MongodbSim, r *http.Request, tableName string, ExcludeUrl []*regexp.Regexp, c int) {
 	for _, v := range ExcludeUrl {
 		// 过滤无意义路由日志
 		if v.MatchString(r.URL.Path) {
@@ -52,7 +52,7 @@ func AddMgoLogs(mgoLog mongodb.MongodbSim, r *http.Request, tableName string, Ex
 	}
 	saveLogsLock.Lock()
 	arr[tableName] = append(arr[tableName], logs)
-	if len(arr[tableName]) >= 500 {
+	if len(arr[tableName]) >= c {
 		tmp := arr[tableName]
 		arr[tableName] = make([]map[string]interface{}, 0)
 		go func() {