Improve loggin for publishing
This commit is contained in:
parent
bcde001866
commit
cae5011ff0
|
@ -50,7 +50,7 @@ func (handler *subscriptionHandler) handlePublish(w http.ResponseWriter, r *http
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, sub := range subs {
|
for _, sub := range subs {
|
||||||
log.Printf("publish: creating post to %s\n", sub.Callback)
|
log.Printf("publish: preparing post to %s\n", sub.Callback)
|
||||||
postReq, err := http.NewRequest("POST", sub.Callback, strings.NewReader(string(feedContent)))
|
postReq, err := http.NewRequest("POST", sub.Callback, strings.NewReader(string(feedContent)))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("could not creating request to %s: %s", sub.Callback, err)
|
log.Printf("could not creating request to %s: %s", sub.Callback, err)
|
||||||
|
@ -69,12 +69,13 @@ func (handler *subscriptionHandler) handlePublish(w http.ResponseWriter, r *http
|
||||||
signature := mac.Sum(nil)
|
signature := mac.Sum(nil)
|
||||||
postReq.Header.Add("X-Hub-Signature", fmt.Sprintf("sha1=%x", signature))
|
postReq.Header.Add("X-Hub-Signature", fmt.Sprintf("sha1=%x", signature))
|
||||||
}
|
}
|
||||||
|
log.Printf("publish: send post to %s\n", sub.Callback)
|
||||||
postRes, err := client.Do(postReq)
|
postRes, err := client.Do(postReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("could not publish to %s: %s", sub.Callback, err)
|
log.Printf("could not publish to %s: %s", sub.Callback, err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
log.Printf("publish: post send to %s\n", sub.Callback)
|
log.Printf("publish: post sent to %s\n", sub.Callback)
|
||||||
log.Println("Response:")
|
log.Println("Response:")
|
||||||
_ = postRes.Write(os.Stdout)
|
_ = postRes.Write(os.Stdout)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user