add agent log

This commit is contained in:
Ulric Qin 2020-12-01 22:32:13 +08:00
parent ebb95a8292
commit c6442ed68a
1 changed files with 3 additions and 0 deletions

View File

@ -1,6 +1,7 @@
package report
import (
"encoding/json"
"fmt"
"math/rand"
"os"
@ -127,6 +128,8 @@ func report() error {
var body errRes
err := httplib.Post(url).JSONBodyQuiet(form).Header("X-Srv-Token", config.Config.Report.Token).SetTimeout(time.Second * 5).ToJSON(&body)
if err != nil {
js, _ := json.Marshal(form)
logger.Errorf("report payload: %s, token: %s", string(js), config.Config.Report.Token)
return fmt.Errorf("curl %s fail: %v", url, err)
}