Skip to content

Commit

Permalink
refactor(slack): Add trace logging of Slack responses (#612)
Browse files Browse the repository at this point in the history
  • Loading branch information
dotdotdotpaul authored and marchello2000 committed Jul 31, 2019
1 parent 00bf6ae commit 8062c4e
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,15 @@ class SlackNotificationService implements NotificationService {
EchoResponse.Void handle(Notification notification) {
def text = notificationTemplateEngine.build(notification, NotificationTemplateEngine.Type.BODY)
notification.to.each {
def response
String address = it.startsWith('#') ? it : "#${it}"
if (sendCompactMessages) {
slack.sendCompactMessage(token, new CompactSlackMessage(text), address, true)
response = slack.sendCompactMessage(token, new CompactSlackMessage(text), address, true)
} else {
slack.sendMessage(token, new SlackAttachment("Spinnaker Notification", text), address, true)
response = slack.sendMessage(token, new SlackAttachment("Spinnaker Notification", text), address, true)
}
log.trace("Received response from Slack: {} {} for message '{}'. {}",
response?.status, response?.reason, text, response?.body)
}

new EchoResponse.Void()
Expand Down

0 comments on commit 8062c4e

Please sign in to comment.