Browse Source

log replace fmt

tags/v1.21.12.1
Gitea 3 years ago
parent
commit
ea79350b83
1 changed files with 4 additions and 5 deletions
  1. +4
    -5
      modules/repository/elk_pagedata.go

+ 4
- 5
modules/repository/elk_pagedata.go View File

@@ -4,10 +4,10 @@ import (
"bytes"
"encoding/base64"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"

"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
)

@@ -119,7 +119,7 @@ func GetResultFromElk(resultInfo ResultInfo, jsonStr []byte) (loaded int, totalV
body, _ := ioutil.ReadAll(resp.Body)

errs := json.Unmarshal([]byte(string(body)), &resultInfo)
fmt.Println(errs)
log.Info("Get resultJson failed", errs)

return resultInfo.Result.Loaded, resultInfo.Result.RawResponse.Hits.Total, err
}
@@ -210,9 +210,8 @@ func TagNameInit(MessageInfo string, Tagname string, Gte string, Lte string) (pr
func ViewInfo(viewInfo InputInfo) (totalView int, err error) {
jsons, errs := json.Marshal(viewInfo)
if errs != nil {
fmt.Println("errs:", errs.Error())
log.Info("errs:", errs)
}
fmt.Println("viewInfoInit:", string(jsons))
var jsonStr = []byte(jsons)
var resultInfo ResultInfo
loaded, totalView, err := GetResultFromElk(resultInfo, jsonStr)
@@ -222,7 +221,7 @@ func ViewInfo(viewInfo InputInfo) (totalView int, err error) {
if loaded == 0 {
loaded_next, totalView, err := GetResultFromElk(resultInfo, jsonStr)
time++
fmt.Println("time:", time)
log.Info("time:", time)
if loaded_next != 0 && time < 100 {
return totalView, err
}


Loading…
Cancel
Save