Skip to content

Commit

Permalink
Merge pull request #408 from fenollp/encode-usefully
Browse files Browse the repository at this point in the history
feat: redo input/response encoding for easy parsing
  • Loading branch information
bojand committed Apr 15, 2023
2 parents d926cf4 + 4cf0d12 commit 0aabbc9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions runner/worker.go
Expand Up @@ -2,6 +2,7 @@ package runner

import (
"context"
"encoding/json"
"errors"
"fmt"
"io"
Expand Down Expand Up @@ -177,10 +178,13 @@ func (w *Worker) makeUnaryRequest(ctx *context.Context, reqMD *metadata.MD, inpu
res, resErr = w.stub.InvokeRpc(*ctx, w.mtd, input, callOptions...)

if w.config.hasLog {
inputData, _ := input.MarshalJSON()
resData, _ := json.Marshal(res)

w.config.log.Debugw("Received response", "workerID", w.workerID, "call type", "unary",
"call", w.mtd.GetFullyQualifiedName(),
"input", input, "metadata", reqMD,
"response", res, "error", resErr)
"input", string(inputData), "metadata", reqMD,
"response", string(resData), "error", resErr)
}

return resErr
Expand Down

0 comments on commit 0aabbc9

Please sign in to comment.