Skip to content

Commit

Permalink
update v2 client
Browse files Browse the repository at this point in the history
  • Loading branch information
cewkrupa committed Nov 20, 2024
1 parent 272be03 commit bd2a59e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
3 changes: 1 addition & 2 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,9 @@ func NewClientWithConfig(config *Config) (*Client, error) {
}

if config.Debug {
// if enabled we log all requests and responses to sterr
client.httpClient.Logger = log.New(os.Stderr, "", log.LstdFlags)
client.httpClient.ResponseLogHook = func(l retryablehttp.Logger, resp *http.Response) {
l.Printf("[DEBUG] Request: %s \"%s\" %s %s", resp.Request.Method, resp.Request.URL.String(), resp.Status, resp.Header.Get("Request-Id"))
l.Printf("[DEBUG] %s \"%s\" %s %s", resp.Request.Method, resp.Request.URL.String(), resp.Status, resp.Header.Get("Request-Id"))
}
}

Expand Down
4 changes: 1 addition & 3 deletions client/v2/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,9 @@ func NewClientWithConfig(config *Config) (*Client, error) {
}

if config.Debug {
// if enabled we log all requests and responses to sterr
client.http.Logger = log.New(os.Stderr, "", log.LstdFlags)
client.http.ResponseLogHook = func(l retryablehttp.Logger, resp *http.Response) {
l.Printf("[DEBUG] Request: %s %s", resp.Request.Method, resp.Request.URL.String())
// TODO: Log request body
l.Printf("[DEBUG] %s \"%s\" %s %s", resp.Request.Method, resp.Request.URL.String(), resp.Status, resp.Header.Get("Request-Id"))
}
}

Expand Down

0 comments on commit bd2a59e

Please sign in to comment.