pidgin/carrier

Add more logging so I can debug
draft
2019-05-14, Gary Kramlich
812f4d291061
Parents 3fe33eeb5a02
Children 937f50c92885
Add more logging so I can debug
--- a/uptimerobot/uptimerobot.go Tue May 14 21:55:10 2019 -0500
+++ b/uptimerobot/uptimerobot.go Tue May 14 22:30:06 2019 -0500
@@ -5,6 +5,7 @@
"net/http"
"bitbucket.org/ckvist/twilio/twirest"
+ log "github.com/sirupsen/logrus"
"bitbucket.org/pidgin/carrier/config"
)
@@ -59,6 +60,7 @@
func Handler(w http.ResponseWriter, r *http.Request) {
// validate that the request has everything we need/want
if status := validate(r); status != 0 {
+ log.Debugf("status returned: %d", status)
w.WriteHeader(status)
return
}
@@ -73,11 +75,12 @@
// now send the sms
resp, err := sendSMS(content)
if err != nil {
+ log.Warnf("failed to send SMS: %v", err)
w.WriteHeader(resp.Status.Http)
fmt.Fprintf(w, "%s", err)
return
}
+ log.Debugf("status: %#v", resp.Status)
w.WriteHeader(http.StatusOK)
- fmt.Fprintf(w, "%s", resp.Status)
}