From ef7bd74e4a1b31f45cdfaae08f6a8d7cd5992f22 Mon Sep 17 00:00:00 2001 From: Oliver Jakoubek Date: Fri, 23 Jan 2026 11:42:11 +0100 Subject: [PATCH] Added debug output to jsonrpc.go --- jsonrpc.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/jsonrpc.go b/jsonrpc.go index dd10269..f1cedb2 100644 --- a/jsonrpc.go +++ b/jsonrpc.go @@ -60,6 +60,10 @@ func (c *Client) call(ctx context.Context, method string, params interface{}, re return fmt.Errorf("failed to marshal request: %w", err) } + if c.logger != nil { + c.logger.Debug("JSON-RPC request", "method", method, "body", string(body)) + } + httpReq, err := http.NewRequestWithContext(ctx, http.MethodPost, c.endpoint, bytes.NewReader(body)) if err != nil { return fmt.Errorf("failed to create request: %w", err) @@ -92,6 +96,10 @@ func (c *Client) call(ctx context.Context, method string, params interface{}, re return fmt.Errorf("failed to read response body: %w", err) } + if c.logger != nil { + c.logger.Debug("JSON-RPC response", "method", method, "body", string(respBody)) + } + var rpcResp JSONRPCResponse if err := json.Unmarshal(respBody, &rpcResp); err != nil { return fmt.Errorf("failed to unmarshal response: %w", err)