Commit 6b901773 authored by Ogundele Olumide's avatar Ogundele Olumide Committed by Jesús Espino
Browse files

MM-18274 Refactor "app/email.go" to use structured logging (#12504)

* chore: refactor to use structured logging

 - change fmt.sprintf method used in the logger to appropriate mlog
   method

* implement suggested changes by removing added line during merge conflict
parent 441777a4
......@@ -347,13 +347,13 @@ func (a *App) SendInviteEmails(team *model.Team, senderName string, senderUserId
data := model.MapToJson(props)
if err := a.Srv.Store.Token().Save(token); err != nil {
mlog.Error(fmt.Sprintf("Failed to send invite email successfully err=%v", err))
mlog.Error("Failed to send invite email successfully ", mlog.Err(err))
continue
}
bodyPage.Props["Link"] = fmt.Sprintf("%s/signup_user_complete/?d=%s&t=%s", siteURL, url.QueryEscape(data), url.QueryEscape(token.Token))
if err := a.SendMail(invite, subject, bodyPage.Render()); err != nil {
mlog.Error(fmt.Sprintf("Failed to send invite email successfully err=%v", err))
mlog.Error("Failed to send invite email successfully ", mlog.Err(err))
}
}
}
......@@ -435,13 +435,13 @@ func (a *App) SendGuestInviteEmails(team *model.Team, channels []*model.Channel,
data := model.MapToJson(props)
if err := a.Srv.Store.Token().Save(token); err != nil {
mlog.Error(fmt.Sprintf("Failed to send invite email successfully err=%v", err))
mlog.Error("Failed to send invite email successfully ", mlog.Err(err))
continue
}
bodyPage.Props["Link"] = fmt.Sprintf("%s/signup_user_complete/?d=%s&t=%s", siteURL, url.QueryEscape(data), url.QueryEscape(token.Token))
if !*a.Config().EmailSettings.SendEmailNotifications {
mlog.Info(fmt.Sprintf("sending invitation to %v %v", invite, bodyPage.Props["Link"]))
mlog.Info("sending invitation ", mlog.String("to", invite), mlog.String("link", bodyPage.Props["Link"].(string)))
}
embeddedFiles := make(map[string]io.Reader)
......@@ -454,7 +454,7 @@ func (a *App) SendGuestInviteEmails(team *model.Team, channels []*model.Channel,
}
if err := a.SendMailWithEmbeddedFiles(invite, subject, bodyPage.Render(), embeddedFiles); err != nil {
mlog.Error(fmt.Sprintf("Failed to send invite email successfully err=%v", err))
mlog.Error("Failed to send invite email successfully", mlog.Err(err))
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment