From 7ba491ac2d5ce75c9c8dd19056e823d89745a59f Mon Sep 17 00:00:00 2001 From: Nikhil Ranjan Date: Tue, 24 Sep 2019 15:10:47 +0000 Subject: [PATCH] =?UTF-8?q?Converting=20to=20structured=20logging=20the=20?= =?UTF-8?q?file=20app/notification=5Fpus=E2=80=A6=20(#12126)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/notification_push.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/app/notification_push.go b/app/notification_push.go index 2b4e963186..eb26910774 100644 --- a/app/notification_push.go +++ b/app/notification_push.go @@ -4,7 +4,6 @@ package app import ( - "fmt" "hash/fnv" "net/http" "strings" @@ -174,7 +173,7 @@ func (a *App) getPushNotificationMessage(postMessage string, explicitMention, ch func (a *App) ClearPushNotificationSync(currentSessionId, userId, channelId string) { sessions, err := a.getMobileAppSessions(userId) if err != nil { - mlog.Error(err.Error()) + mlog.Error("error getting mobile app sessions", mlog.Err(err)) return } @@ -187,7 +186,7 @@ func (a *App) ClearPushNotificationSync(currentSessionId, userId, channelId stri if unreadCount, err := a.Srv.Store.User().GetUnreadCount(userId); err != nil { msg.Badge = 0 - mlog.Error(fmt.Sprint("We could not get the unread message count for the user", userId, err), mlog.String("user_id", userId)) + mlog.Error("We could not get the unread message count for", mlog.String("user_id", userId), mlog.Err(err)) } else { msg.Badge = int(unreadCount) } @@ -267,7 +266,7 @@ func (a *App) pushNotificationWorker(notifications chan PushNotification) { notification.replyToThreadType, ) default: - mlog.Error(fmt.Sprintf("Invalid notification type %v", notification.notificationType)) + mlog.Error("Invalid notification type", mlog.String("notification_type", string(notification.notificationType))) } } } @@ -446,14 +445,14 @@ func (a *App) BuildPushNotificationMessage(post *model.Post, user *model.User, c if user.NotifyProps["push"] == "all" { if unreadCount, err := a.Srv.Store.User().GetAnyUnreadPostCountForChannel(user.Id, channel.Id); err != nil { msg.Badge = 1 - mlog.Error(fmt.Sprint("We could not get the unread message count for the user", user.Id, err), mlog.String("user_id", user.Id)) + mlog.Error("We could not get the unread message count for the user", mlog.String("user_id", user.Id), mlog.Err(err)) } else { msg.Badge = int(unreadCount) } } else { if unreadCount, err := a.Srv.Store.User().GetUnreadCount(user.Id); err != nil { msg.Badge = 1 - mlog.Error(fmt.Sprint("We could not get the unread message count for the user", user.Id, err), mlog.String("user_id", user.Id)) + mlog.Error("We could not get the unread message count for the user", mlog.String("user_id", user.Id), mlog.Err(err)) } else { msg.Badge = int(unreadCount) }