aboutsummaryrefslogtreecommitdiff
path: root/plugin/pkg
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/pkg')
-rw-r--r--plugin/pkg/healthcheck/healthcheck.go7
-rw-r--r--plugin/pkg/healthcheck/policy.go5
-rw-r--r--plugin/pkg/healthcheck/policy_test.go4
3 files changed, 7 insertions, 9 deletions
diff --git a/plugin/pkg/healthcheck/healthcheck.go b/plugin/pkg/healthcheck/healthcheck.go
index 2a1a89478..5a2e229cf 100644
--- a/plugin/pkg/healthcheck/healthcheck.go
+++ b/plugin/pkg/healthcheck/healthcheck.go
@@ -3,13 +3,14 @@ package healthcheck
import (
"io"
"io/ioutil"
- "log"
"net"
"net/http"
"net/url"
"sync"
"sync/atomic"
"time"
+
+ "github.com/coredns/coredns/plugin/pkg/log"
)
// UpstreamHostDownFunc can be used to customize how Down behaves.
@@ -122,7 +123,7 @@ func (uh *UpstreamHost) HealthCheckURL() {
}()
if err != nil {
- log.Printf("[WARNING] Host %s health check probe failed: %v", uh.Name, err)
+ log.Warningf("Host %s health check probe failed: %v", uh.Name, err)
atomic.AddInt32(&uh.Fails, 1)
return
}
@@ -132,7 +133,7 @@ func (uh *UpstreamHost) HealthCheckURL() {
r.Body.Close()
if r.StatusCode < 200 || r.StatusCode >= 400 {
- log.Printf("[WARNING] Host %s health check returned HTTP code %d", uh.Name, r.StatusCode)
+ log.Warningf("Host %s health check returned HTTP code %d", uh.Name, r.StatusCode)
atomic.AddInt32(&uh.Fails, 1)
return
}
diff --git a/plugin/pkg/healthcheck/policy.go b/plugin/pkg/healthcheck/policy.go
index 070213900..3b8ade852 100644
--- a/plugin/pkg/healthcheck/policy.go
+++ b/plugin/pkg/healthcheck/policy.go
@@ -1,9 +1,10 @@
package healthcheck
import (
- "log"
"math/rand"
"sync/atomic"
+
+ "github.com/coredns/coredns/plugin/pkg/log"
)
var (
@@ -64,7 +65,7 @@ type Spray struct{}
func (r *Spray) Select(pool HostPool) *UpstreamHost {
rnd := rand.Int() % len(pool)
randHost := pool[rnd]
- log.Printf("[WARNING] All hosts reported as down, spraying to target: %s", randHost.Name)
+ log.Warningf("All hosts reported as down, spraying to target: %s", randHost.Name)
return randHost
}
diff --git a/plugin/pkg/healthcheck/policy_test.go b/plugin/pkg/healthcheck/policy_test.go
index ddf5a1415..a9b2dc51b 100644
--- a/plugin/pkg/healthcheck/policy_test.go
+++ b/plugin/pkg/healthcheck/policy_test.go
@@ -1,8 +1,6 @@
package healthcheck
import (
- "io/ioutil"
- "log"
"net/http"
"net/http/httptest"
"os"
@@ -13,8 +11,6 @@ import (
var workableServer *httptest.Server
func TestMain(m *testing.M) {
- log.SetOutput(ioutil.Discard)
-
workableServer = httptest.NewServer(http.HandlerFunc(
func(w http.ResponseWriter, r *http.Request) {
// do nothing