Browse Source

More logging

pull/36/head
Kegan Dougal 9 years ago
parent
commit
cacdc632a4
  1. 6
      src/github.com/matrix-org/go-neb/api.go
  2. 4
      src/github.com/matrix-org/go-neb/services/github/github.go

6
src/github.com/matrix-org/go-neb/api.go

@ -136,6 +136,7 @@ type webhookHandler struct {
}
func (wh *webhookHandler) handle(w http.ResponseWriter, req *http.Request) {
log.WithField("path", req.URL.RawPath).Print("Incoming webhook request")
segments := strings.Split(req.URL.Path, "/")
// last path segment is the service ID which we will pass the incoming request to,
// but we've base64d it.
@ -164,8 +165,9 @@ func (wh *webhookHandler) handle(w http.ResponseWriter, req *http.Request) {
return
}
log.WithFields(log.Fields{
"service_id": service.ServiceID(),
}).Print("Incoming webhook")
"service_id": service.ServiceID(),
"service_typ": service.ServiceType(),
}).Print("Incoming webhook for service")
service.OnReceiveWebhook(w, req, cli)
}

4
src/github.com/matrix-org/go-neb/services/github/github.go

@ -292,6 +292,8 @@ func modifyWebhooks(s *githubService, cli *github.Client, removeHooks bool) {
if err != nil {
logger.WithError(err).Print("Failed to create webhook")
// continue as others may succeed
} else {
logger.WithField("endpoint", s.webhookEndpointURL).Print("Created hook with endpoint")
}
}
}
@ -396,6 +398,7 @@ func removeHook(logger *log.Entry, cli *github.Client, owner, repo, webhookEndpo
}
}
if hook == nil {
logger.WithField("endpoint", webhookEndpointURL).Print("Failed to find hook with endpoint")
return // couldn't find it
}
@ -403,6 +406,7 @@ func removeHook(logger *log.Entry, cli *github.Client, owner, repo, webhookEndpo
if err != nil {
logger.WithError(err).Print("Failed to delete hook")
}
logger.WithField("endpoint", webhookEndpointURL).Print("Deleted hook")
}
func init() {

|||||||
100:0
Loading…
Cancel
Save