Skip to content
This repository has been archived by the owner on Oct 11, 2023. It is now read-only.

Commit

Permalink
Adjust log output
Browse files Browse the repository at this point in the history
  • Loading branch information
niusmallnan committed Aug 17, 2019
1 parent a8cf965 commit 3fac5f7
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions config/cloudinit/pkg/http_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ import (
"errors"
"fmt"
"io/ioutil"
"log"
"net/http"
neturl "net/url"
"strings"
"time"

"github.com/rancher/os/pkg/log"
)

const (
Expand Down Expand Up @@ -120,22 +121,22 @@ func (h *HTTPClient) GetRetry(rawurl string) ([]byte, error) {

duration := h.InitialBackoff
for retry := 1; retry <= h.MaxRetries; retry++ {
log.Printf("Fetching data from %s. Attempt #%d", dataURL, retry)
log.Debugf("Fetching data from %s. Attempt #%d", dataURL, retry)

data, err := h.Get(dataURL)
switch err.(type) {
case ErrNetwork:
log.Printf(err.Error())
log.Debugf(err.Error())
case ErrServer:
log.Printf(err.Error())
log.Debugf(err.Error())
case ErrNotFound:
return data, err
default:
return data, err
}

duration = ExpBackoff(duration, h.MaxBackoff)
log.Printf("Sleeping for %v...", duration)
log.Debugf("Sleeping for %v...", duration)
time.Sleep(duration)
}

Expand Down

0 comments on commit 3fac5f7

Please sign in to comment.