aboutsummaryrefslogtreecommitdiff
path: root/internal/mailer
diff options
context:
space:
mode:
authorᴜɴᴋɴᴡᴏɴ <u@gogs.io>2020-02-20 02:25:02 +0800
committerGitHub <noreply@github.com>2020-02-20 02:25:02 +0800
commit1c09373b4f7dbc68154c817b4ee44bfa3b3f637c (patch)
treeaeec9a80d10f9ef28f0d0b128f8a84bf3cb5bdb1 /internal/mailer
parent422a20648466f270de195dce3bca04e977bacd13 (diff)
log: migrate to unknwon.dev/clog/v2 (#5927)
* Add unknwon.dev/clog/v2 * Update all places
Diffstat (limited to 'internal/mailer')
-rw-r--r--internal/mailer/mail.go12
-rw-r--r--internal/mailer/mailer.go6
2 files changed, 9 insertions, 9 deletions
diff --git a/internal/mailer/mail.go b/internal/mailer/mail.go
index 1cb01a57..f4bf9414 100644
--- a/internal/mailer/mail.go
+++ b/internal/mailer/mail.go
@@ -11,9 +11,9 @@ import (
"sync"
"time"
- log "gopkg.in/clog.v1"
"gopkg.in/gomail.v2"
"gopkg.in/macaron.v1"
+ log "unknwon.dev/clog/v2"
"gogs.io/gogs/internal/assets/templates"
"gogs.io/gogs/internal/markup"
@@ -111,7 +111,7 @@ func SendUserMail(c *macaron.Context, u User, tpl, code, subject, info string) {
}
body, err := render(tpl, data)
if err != nil {
- log.Error(2, "render: %v", err)
+ log.Error("render: %v", err)
return
}
@@ -139,7 +139,7 @@ func SendActivateEmailMail(c *macaron.Context, u User, email string) {
}
body, err := render(MAIL_AUTH_ACTIVATE_EMAIL, data)
if err != nil {
- log.Error(3, "HTMLString: %v", err)
+ log.Error("HTMLString: %v", err)
return
}
@@ -156,7 +156,7 @@ func SendRegisterNotifyMail(c *macaron.Context, u User) {
}
body, err := render(MAIL_AUTH_REGISTER_NOTIFY, data)
if err != nil {
- log.Error(3, "HTMLString: %v", err)
+ log.Error("HTMLString: %v", err)
return
}
@@ -177,7 +177,7 @@ func SendCollaboratorMail(u, doer User, repo Repository) {
}
body, err := render(MAIL_NOTIFY_COLLABORATOR, data)
if err != nil {
- log.Error(3, "HTMLString: %v", err)
+ log.Error("HTMLString: %v", err)
return
}
@@ -202,7 +202,7 @@ func composeIssueMessage(issue Issue, repo Repository, doer User, tplName string
data["Doer"] = doer
content, err := render(tplName, data)
if err != nil {
- log.Error(3, "HTMLString (%s): %v", tplName, err)
+ log.Error("HTMLString (%s): %v", tplName, err)
}
from := gomail.NewMessage().FormatAddress(setting.MailService.FromEmail, doer.DisplayName())
msg := NewMessageFrom(tos, from, subject, content)
diff --git a/internal/mailer/mailer.go b/internal/mailer/mailer.go
index 88315138..40b2b5a8 100644
--- a/internal/mailer/mailer.go
+++ b/internal/mailer/mailer.go
@@ -15,8 +15,8 @@ import (
"time"
"github.com/jaytaylor/html2text"
- log "gopkg.in/clog.v1"
"gopkg.in/gomail.v2"
+ log "unknwon.dev/clog/v2"
"gogs.io/gogs/internal/setting"
)
@@ -43,7 +43,7 @@ func NewMessageFrom(to []string, from, subject, htmlBody string) *Message {
if setting.MailService.UsePlainText || setting.MailService.AddPlainTextAlt {
plainBody, err := html2text.FromString(htmlBody)
if err != nil {
- log.Error(2, "html2text.FromString: %v", err)
+ log.Error("html2text.FromString: %v", err)
} else {
contentType = "text/plain"
body = plainBody
@@ -209,7 +209,7 @@ func processMailQueue() {
case msg := <-mailQueue:
log.Trace("New e-mail sending request %s: %s", msg.GetHeader("To"), msg.Info)
if err := gomail.Send(sender, msg.Message); err != nil {
- log.Error(3, "Fail to send emails %s: %s - %v", msg.GetHeader("To"), msg.Info, err)
+ log.Error("Failed to send emails %s: %s - %v", msg.GetHeader("To"), msg.Info, err)
} else {
log.Trace("E-mails sent %s: %s", msg.GetHeader("To"), msg.Info)
}