mirror of
https://github.com/speatzle/nfsense.git
synced 2025-05-11 02:48:21 +00:00
Add Parameters to API Method error logging
This commit is contained in:
parent
3bd8106511
commit
e527329094
1 changed files with 2 additions and 2 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue