Skip to content

Commit

Permalink
remove zap logs and use fmt
Browse files Browse the repository at this point in the history
Signed-off-by: jnathangreeg <[email protected]>
  • Loading branch information
jnathangreeg committed Oct 9, 2024
1 parent 2ec0c64 commit a6b056c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ require (
github.com/kr/pretty v0.3.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/rogpeppe/go-internal v1.11.0 // indirect
go.uber.org/multierr v1.10.0 // indirect
go.uber.org/zap v1.27.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
4 changes: 0 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDN
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ=
go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
Expand Down
9 changes: 4 additions & 5 deletions httputils/httphelpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"time"

"github.com/cenkalti/backoff"
"go.uber.org/zap"
)

type IHttpClient interface {
Expand Down Expand Up @@ -87,22 +86,22 @@ func HttpPostWithContext(ctx context.Context, httpClient IHttpClient, fullURL st
operation := func() error {
req, err := http.NewRequestWithContext(ctx, "POST", fullURL, bytes.NewReader(body))
if err != nil {
zap.L().Error("error creating request", zap.Error(err), zap.String("line", "90"))
fmt.Println("error creating request", err, "line 90")
return backoff.Permanent(err)
}
setHeaders(req, headers)

resp, err = httpClient.Do(req)
if err != nil {
zap.L().Error("error sending request", zap.Error(err), zap.String("line", "97"))
fmt.Println("error sending request", err, "line 97")
return err
}
defer resp.Body.Close()

// If the status code is not 200, we will retry
if resp.StatusCode != http.StatusOK {
if shouldRetry(resp) {
zap.L().Error("received status code", zap.Int("status_code", resp.StatusCode), zap.String("line", "105"))
fmt.Println("received status code", resp.StatusCode, "line 105")
return fmt.Errorf("received status code: %d", resp.StatusCode)
}
return backoff.Permanent(err)
Expand All @@ -117,7 +116,7 @@ func HttpPostWithContext(ctx context.Context, httpClient IHttpClient, fullURL st

// Run the operation with the exponential backoff policy
if err = backoff.Retry(operation, expBackOff); err != nil {
zap.L().Error("error sending request", zap.Error(err), zap.String("line", "121"))
fmt.Println("error retrying request", err, "line 120")
return resp, err
}

Expand Down

0 comments on commit a6b056c

Please sign in to comment.