@@ -12,7 +12,6 @@ import (
12
12
"time"
13
13
14
14
"github.com/cenkalti/backoff"
15
- "go.uber.org/zap"
16
15
)
17
16
18
17
type IHttpClient interface {
@@ -87,22 +86,22 @@ func HttpPostWithContext(ctx context.Context, httpClient IHttpClient, fullURL st
87
86
operation := func () error {
88
87
req , err := http .NewRequestWithContext (ctx , "POST" , fullURL , bytes .NewReader (body ))
89
88
if err != nil {
90
- zap . L (). Error ( "error creating request" , zap . Error ( err ), zap . String ( "line" , " 90") )
89
+ fmt . Println ( "error creating request" , err , "line 90" )
91
90
return backoff .Permanent (err )
92
91
}
93
92
setHeaders (req , headers )
94
93
95
94
resp , err = httpClient .Do (req )
96
95
if err != nil {
97
- zap . L (). Error ( "error sending request" , zap . Error ( err ), zap . String ( "line" , " 97") )
96
+ fmt . Println ( "error sending request" , err , "line 97" )
98
97
return err
99
98
}
100
99
defer resp .Body .Close ()
101
100
102
101
// If the status code is not 200, we will retry
103
102
if resp .StatusCode != http .StatusOK {
104
103
if shouldRetry (resp ) {
105
- zap . L (). Error ( "received status code" , zap . Int ( "status_code" , resp .StatusCode ), zap . String ( "line" , " 105") )
104
+ fmt . Println ( "received status code" , resp .StatusCode , "line 105" )
106
105
return fmt .Errorf ("received status code: %d" , resp .StatusCode )
107
106
}
108
107
return backoff .Permanent (err )
@@ -117,7 +116,7 @@ func HttpPostWithContext(ctx context.Context, httpClient IHttpClient, fullURL st
117
116
118
117
// Run the operation with the exponential backoff policy
119
118
if err = backoff .Retry (operation , expBackOff ); err != nil {
120
- zap . L (). Error ( "error sending request" , zap . Error ( err ), zap . String ( "line" , "121" ) )
119
+ fmt . Println ( "error retrying request" , err , "line 120" )
121
120
return resp , err
122
121
}
123
122
0 commit comments