From 5b43c429b91476e7d93d67ddcdd5eb64eea6e892 Mon Sep 17 00:00:00 2001 From: Julio Capote Date: Thu, 5 Jan 2023 08:35:05 -0500 Subject: add logging --- registry/registry.go | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'registry') diff --git a/registry/registry.go b/registry/registry.go index 28871bf..89dd7a1 100644 --- a/registry/registry.go +++ b/registry/registry.go @@ -250,8 +250,17 @@ func (r *Registry) deliverAcceptToInbox(url, actorUrl *url.URL, follow vocab.Act privKey := &keypair.PrivateKey request, err := http.NewRequest("POST", url.String(), bytes.NewBuffer(jsonData)) + r.log.With( + "type", + "delivery", + ).With( + "payload", + payload, + ).With( + "digest", + request.Header.Get("digest"), + ).Debugf("signing request") - r.log.With("type", "delivery").With("payload", payload).Debugf("signing") r.mu.Lock() defer r.mu.Unlock() prefs := []httpsig.Algorithm{httpsig.RSA_SHA256} @@ -268,7 +277,23 @@ func (r *Registry) deliverAcceptToInbox(url, actorUrl *url.URL, follow vocab.Act // If r were a http.ResponseWriter, call SignResponse instead. err = signer.SignRequest(privKey, actorUrl.String(), request, nil) - r.log.With("type", "delivery").With("inbox", url.String()).With("actor", actorUrl.String()).Debugf("sending accept") + r.log.With( + "type", + "delivery", + ).With( + "inbox", + url.String(), + ).With( + "digest", + request.Header.Get("digest"), + ).With( + "signature", + request.Header.Get("signature"), + ).With( + "actor", + actorUrl.String(), + ).Debug("sending signed accept request") + client := &http.Client{} response, err := client.Do(request) if err != nil { -- cgit v1.2.3