Update all plugins to use plugin/pkg/log (#1694)

* Update all plugins to use plugin/pkg/log

I wish this could have been done with sed. Alas manually changed all
callers to use the new plugin/pkg/log package.

* Error -> Info

* Add docs to debug plugin as well
This commit is contained in:
Miek Gieben
2018-04-19 07:41:56 +01:00
committed by GitHub
parent 2095eb7979
commit 26d1432ae6
36 changed files with 101 additions and 132 deletions

View File

@@ -5,13 +5,13 @@ import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net"
"net/http"
"net/url"
"time"
"github.com/coredns/coredns/plugin/pkg/healthcheck"
"github.com/coredns/coredns/plugin/pkg/log"
"github.com/coredns/coredns/request"
"github.com/miekg/dns"
@@ -65,7 +65,7 @@ func (g *google) Exchange(ctx context.Context, addr string, state request.Reques
return m, nil
}
log.Printf("[WARNING] Failed to connect to HTTPS backend %q: %s", g.endpoint, backendErr)
log.Warningf("Failed to connect to HTTPS backend %q: %s", g.endpoint, backendErr)
return nil, backendErr
}
@@ -119,17 +119,17 @@ func (g *google) OnStartup(p *Proxy) error {
new, err := g.bootstrapProxy.Lookup(state, g.endpoint, dns.TypeA)
if err != nil {
log.Printf("[WARNING] Failed to bootstrap A records %q: %s", g.endpoint, err)
log.Warningf("Failed to bootstrap A records %q: %s", g.endpoint, err)
} else {
addrs, err1 := extractAnswer(new)
if err1 != nil {
log.Printf("[WARNING] Failed to bootstrap A records %q: %s", g.endpoint, err1)
log.Warningf("Failed to bootstrap A records %q: %s", g.endpoint, err1)
} else {
up := newUpstream(addrs, oldUpstream.(*staticUpstream))
p.Upstreams = &[]Upstream{up}
log.Printf("[INFO] Bootstrapping A records %q found: %v", g.endpoint, addrs)
log.Infof("Bootstrapping A records %q found: %v", g.endpoint, addrs)
}
}
@@ -140,24 +140,24 @@ func (g *google) OnStartup(p *Proxy) error {
select {
case <-tick.C:
log.Printf("[INFO] Resolving A records %q", g.endpoint)
log.Infof("Resolving A records %q", g.endpoint)
new, err := g.bootstrapProxy.Lookup(state, g.endpoint, dns.TypeA)
if err != nil {
log.Printf("[WARNING] Failed to resolve A records %q: %s", g.endpoint, err)
log.Warningf("Failed to resolve A records %q: %s", g.endpoint, err)
continue
}
addrs, err1 := extractAnswer(new)
if err1 != nil {
log.Printf("[WARNING] Failed to resolve A records %q: %s", g.endpoint, err1)
log.Warningf("Failed to resolve A records %q: %s", g.endpoint, err1)
continue
}
up := newUpstream(addrs, oldUpstream.(*staticUpstream))
p.Upstreams = &[]Upstream{up}
log.Printf("[INFO] Resolving A records %q found: %v", g.endpoint, addrs)
log.Infof("Resolving A records %q found: %v", g.endpoint, addrs)
case <-g.quit:
return