Skip to content

Commit

Permalink
refactor: better logging
Browse files Browse the repository at this point in the history
  • Loading branch information
hazcod committed May 31, 2021
1 parent 35eec45 commit c46b86b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ func main() {
WithField("tags", device.Tags).
WithField("prefix", tagEmailPrefix).
WithField("device", device.MachineName).
Warn("could not find user email, using fallback user")
Warn("could extract user email tag, using fallback Slack user")

userEmail = config.Slack.FallbackUser
}
Expand All @@ -262,6 +262,8 @@ func main() {
users[userEmail] = user
}

logrus.Debugf("%+v", users)

slackClient := slack.New(config.Slack.Token)

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

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

var theSlackUser slack.User
for _, slackUser := range slackUsers {
Expand Down Expand Up @@ -318,5 +321,9 @@ func main() {
Error("could not send slack message")
continue
}

logrus.
WithField("user", user.Email).WithField("devices", len(user.Devices)).
Info("sent reminder on Slack")
}
}

0 comments on commit c46b86b

Please sign in to comment.