From e5273290949f0cd3b46c771e314084570e0cdb82 Mon Sep 17 00:00:00 2001 From: Samuel Lorch Date: Sun, 2 Apr 2023 11:18:09 +0200 Subject: [PATCH] Add Parameters to API Method error logging --- internal/jsonrpc/handler.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/jsonrpc/handler.go b/internal/jsonrpc/handler.go index 30f3ef9..0e8d7ce 100644 --- a/internal/jsonrpc/handler.go +++ b/internal/jsonrpc/handler.go @@ -81,7 +81,7 @@ func (h *Handler) HandleRequest(ctx context.Context, s *session.Session, r io.Re defer func() { if r := recover(); r != nil { - slog.Error("Recovered Panic Executing API Method", fmt.Errorf("%v", r), "method", req.Method, "id", req.ID, "stack", debug.Stack()) + slog.Error("Recovered Panic Executing API Method", fmt.Errorf("%v", r), "method", req.Method, "params", fmt.Sprintf("%+v", params[2]), "id", req.ID, "stack", debug.Stack()) } }() res := method.handlerFunc.Call(params) @@ -89,7 +89,7 @@ func (h *Handler) HandleRequest(ctx context.Context, s *session.Session, r io.Re if !res[1].IsNil() { reqerr := res[1].Interface().(error) - slog.Error("API Method", reqerr, "method", req.Method, "id", req.ID) + slog.Error("API Method", reqerr, "method", req.Method, "id", req.ID, "params", fmt.Sprintf("%+v", params[2])) respondError(w, req.ID, ErrInternalError, reqerr) return nil }