From 45f94e5c0da0ed612b797abc4011aa18ca2c0e81 Mon Sep 17 00:00:00 2001 From: Ari Lotter Date: Wed, 28 Feb 2024 12:11:12 -0500 Subject: [PATCH] add debug logs to provider requests --- ethrpc/ethrpc.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ethrpc/ethrpc.go b/ethrpc/ethrpc.go index 2391304..0fba8fe 100644 --- a/ethrpc/ethrpc.go +++ b/ethrpc/ethrpc.go @@ -97,12 +97,17 @@ func (p *Provider) Do(ctx context.Context, calls ...Call) ([]byte, error) { req.Header.Set("Authorization", fmt.Sprintf("BEARER %s", p.jwtToken)) } + p.log.Debugf("ethrpc: sending request to '%s', headers '%s', body '%s'", p.nodeURL, req.Header, string(b)) + res, err := p.httpClient.Do(req) if err != nil { return nil, superr.Wrap(ErrRequestFail, fmt.Errorf("failed to send request: %w", err)) } defer res.Body.Close() + p.log.Debugf("ethrpc: got response from '%s', response headers '%s'", p.nodeURL, res.Header) + + body, err := io.ReadAll(res.Body) if err != nil { return nil, superr.Wrap(ErrRequestFail, fmt.Errorf("failed to read resposne body: %w", err))