Skip to content

Commit c46b86b

Browse files
committed
refactor: better logging
1 parent 35eec45 commit c46b86b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

cmd/main.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ func main() {
244244
WithField("tags", device.Tags).
245245
WithField("prefix", tagEmailPrefix).
246246
WithField("device", device.MachineName).
247-
Warn("could not find user email, using fallback user")
247+
Warn("could extract user email tag, using fallback Slack user")
248248

249249
userEmail = config.Slack.FallbackUser
250250
}
@@ -262,6 +262,8 @@ func main() {
262262
users[userEmail] = user
263263
}
264264

265+
logrus.Debugf("%+v", users)
266+
265267
slackClient := slack.New(config.Slack.Token)
266268

267269
logrus.Info("fetching slack users")
@@ -271,6 +273,7 @@ func main() {
271273
}
272274

273275
for _, user := range users {
276+
logrus.WithField("user", user.Email).Debug("handling user at risk")
274277

275278
var theSlackUser slack.User
276279
for _, slackUser := range slackUsers {
@@ -318,5 +321,9 @@ func main() {
318321
Error("could not send slack message")
319322
continue
320323
}
324+
325+
logrus.
326+
WithField("user", user.Email).WithField("devices", len(user.Devices)).
327+
Info("sent reminder on Slack")
321328
}
322329
}

0 commit comments

Comments
 (0)