Commit 63efef57 authored by Sietse Ringers's avatar Sietse Ringers
Browse files

Make retryable http client more verbose if verbose flag is on

parent 018e45d6
......@@ -7,8 +7,10 @@ import (
"fmt"
"io"
"io/ioutil"
"log"
"net"
"net/http"
"os"
"path/filepath"
"strings"
"time"
......@@ -29,6 +31,14 @@ type HTTPTransport struct {
const verbose = false
var transportlogger *log.Logger
func init() {
if verbose {
transportlogger = log.New(os.Stdout, "transport: ", 0)
}
}
// NewHTTPTransport returns a new HTTPTransport.
func NewHTTPTransport(serverURL string) *HTTPTransport {
url := serverURL
......@@ -54,7 +64,7 @@ func NewHTTPTransport(serverURL string) *HTTPTransport {
client.RetryMax = 3
client.RetryWaitMin = 100 * time.Millisecond
client.RetryWaitMax = 500 * time.Millisecond
client.Logger = nil
client.Logger = transportlogger
client.HTTPClient = &http.Client{
Timeout: time.Second * 5,
Transport: &innerTransport,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment