diff --git a/alert/dispatch/dispatch.go b/alert/dispatch/dispatch.go index ed97861f8..deb5e1914 100644 --- a/alert/dispatch/dispatch.go +++ b/alert/dispatch/dispatch.go @@ -183,7 +183,10 @@ func (e *Dispatch) Send(rule *models.AlertRule, event *models.AlertCurEvent, not logger.Warningf("no sender for channel: %s", channel) continue } - logger.Debugf("send event: %s, channel: %s, uids: %+v", event.Hash, channel, ctx.Users) + logger.Debugf("send event: %s, channel: %s", event.Hash, channel) + for i := 0; i < len(ctx.Users); i++ { + logger.Debug("send event to user: ", ctx.Users[i]) + } s.Send(ctx) } diff --git a/models/user.go b/models/user.go index 4f25e86ed..4d1e0ce3f 100644 --- a/models/user.go +++ b/models/user.go @@ -57,6 +57,15 @@ func (u *User) TableName() string { return "users" } +func (u *User) String() string { + bs, err := u.Contacts.MarshalJSON() + if err != nil { + return err.Error() + } + + return fmt.Sprintf("", u.Id, u.Username, u.Nickname, u.Email, u.Phone, string(bs)) +} + func (u *User) IsAdmin() bool { for i := 0; i < len(u.RolesLst); i++ { if u.RolesLst[i] == AdminRole {