Skip to content

Commit

Permalink
feat: logging request
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcos committed Dec 23, 2022
1 parent ff906bd commit d2427e2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions call.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,18 +142,22 @@ func (c *Call[T]) callEndpoint(ctx context.Context, e *Endpoint) (err error) {
}()
}

c.log("[withttp] %s %s", req.Method(), req.URL().String())

res, err := c.client.Do(ctx, req)

if c.ReqIsStream {
wg.Wait()
}

c.log("%s %s returned status code %d", req.Method(), req.URL().String(), res.Status())

if err != nil {
return
}

if res != nil {
c.log("[withttp] server returned status code %d", res.Status())
}

defer func() { c.Res = res }()

if e != nil {
Expand Down

0 comments on commit d2427e2

Please sign in to comment.