提交 a232e7df 编写于 作者: U UlricQin

add some logs

上级 36e11977
...@@ -8,6 +8,8 @@ import ( ...@@ -8,6 +8,8 @@ import (
"time" "time"
"xorm.io/xorm" "xorm.io/xorm"
"github.com/toolkits/pkg/logger"
) )
type Stra struct { type Stra struct {
...@@ -448,47 +450,56 @@ func (s *Stra) Decode() error { ...@@ -448,47 +450,56 @@ func (s *Stra) Decode() error {
s.AlertUpgrade, err = AlertUpgradeUnMarshal(s.AlertUpgradeStr) s.AlertUpgrade, err = AlertUpgradeUnMarshal(s.AlertUpgradeStr)
if err != nil { if err != nil {
logger.Errorf("decode strategy(%d) on AlertUpgradeStr fail: %v", s.Id, err)
return err return err
} }
err = json.Unmarshal([]byte(s.ExclNidStr), &s.ExclNid) err = json.Unmarshal([]byte(s.ExclNidStr), &s.ExclNid)
if err != nil { if err != nil {
logger.Errorf("decode strategy(%d) on ExclNid fail: %v", s.Id, err)
return err return err
} }
err = json.Unmarshal([]byte(s.ExprsStr), &s.Exprs) err = json.Unmarshal([]byte(s.ExprsStr), &s.Exprs)
if err != nil { if err != nil {
logger.Errorf("decode strategy(%d) on Exprs fail: %v", s.Id, err)
return err return err
} }
err = json.Unmarshal([]byte(s.TagsStr), &s.Tags) err = json.Unmarshal([]byte(s.TagsStr), &s.Tags)
if err != nil { if err != nil {
logger.Errorf("decode strategy(%d) on Tags fail: %v", s.Id, err)
return err return err
} }
err = json.Unmarshal([]byte(s.EnableDaysOfWeekStr), &s.EnableDaysOfWeek) err = json.Unmarshal([]byte(s.EnableDaysOfWeekStr), &s.EnableDaysOfWeek)
if err != nil { if err != nil {
logger.Errorf("decode strategy(%d) on EnableDaysOfWeek fail: %v", s.Id, err)
return err return err
} }
err = json.Unmarshal([]byte(s.ConvergeStr), &s.Converge) err = json.Unmarshal([]byte(s.ConvergeStr), &s.Converge)
if err != nil { if err != nil {
logger.Errorf("decode strategy(%d) on Converge fail: %v", s.Id, err)
return err return err
} }
err = json.Unmarshal([]byte(s.NotifyUserStr), &s.NotifyUser) err = json.Unmarshal([]byte(s.NotifyUserStr), &s.NotifyUser)
if err != nil { if err != nil {
logger.Errorf("decode strategy(%d) on NotifyUser fail: %v", s.Id, err)
return err return err
} }
err = json.Unmarshal([]byte(s.NotifyGroupStr), &s.NotifyGroup) err = json.Unmarshal([]byte(s.NotifyGroupStr), &s.NotifyGroup)
if err != nil { if err != nil {
logger.Errorf("decode strategy(%d) on NotifyGroup fail: %v", s.Id, err)
return err return err
} }
if s.WorkGroupsStr != "" { if s.WorkGroupsStr != "" {
err = json.Unmarshal([]byte(s.WorkGroupsStr), &s.WorkGroups) err = json.Unmarshal([]byte(s.WorkGroupsStr), &s.WorkGroups)
if err != nil { if err != nil {
logger.Errorf("decode strategy(%d) on WorkGroups fail: %v", s.Id, err)
return err return err
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册