mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 08:14:18 -04:00
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:
@@ -1,7 +1,6 @@
|
||||
package auto
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
"path"
|
||||
"regexp"
|
||||
@@ -11,6 +10,7 @@ import (
|
||||
"github.com/coredns/coredns/core/dnsserver"
|
||||
"github.com/coredns/coredns/plugin"
|
||||
"github.com/coredns/coredns/plugin/metrics"
|
||||
"github.com/coredns/coredns/plugin/pkg/log"
|
||||
"github.com/coredns/coredns/plugin/pkg/parse"
|
||||
"github.com/coredns/coredns/plugin/pkg/upstream"
|
||||
|
||||
@@ -108,7 +108,7 @@ func autoParse(c *caddy.Controller) (Auto, error) {
|
||||
_, err := os.Stat(a.loader.directory)
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
log.Printf("[WARNING] Directory does not exist: %s", a.loader.directory)
|
||||
log.Warningf("Directory does not exist: %s", a.loader.directory)
|
||||
} else {
|
||||
return a, c.Errf("Unable to access root path '%s': %v", a.loader.directory, err)
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package auto
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
|
||||
"github.com/coredns/coredns/plugin/file"
|
||||
"github.com/coredns/coredns/plugin/pkg/log"
|
||||
|
||||
"github.com/miekg/dns"
|
||||
)
|
||||
@@ -40,7 +40,7 @@ func (a Auto) Walk() error {
|
||||
|
||||
reader, err := os.Open(path)
|
||||
if err != nil {
|
||||
log.Printf("[WARNING] Opening %s failed: %s", path, err)
|
||||
log.Warningf("Opening %s failed: %s", path, err)
|
||||
return nil
|
||||
}
|
||||
defer reader.Close()
|
||||
@@ -48,7 +48,7 @@ func (a Auto) Walk() error {
|
||||
// Serial for loading a zone is 0, because it is a new zone.
|
||||
zo, err := file.Parse(reader, origin, path, 0)
|
||||
if err != nil {
|
||||
log.Printf("[WARNING] Parse zone `%s': %v", origin, err)
|
||||
log.Warningf("Parse zone `%s': %v", origin, err)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ func (a Auto) Walk() error {
|
||||
|
||||
zo.Notify()
|
||||
|
||||
log.Printf("[INFO] Inserting zone `%s' from: %s", origin, path)
|
||||
log.Infof("Inserting zone `%s' from: %s", origin, path)
|
||||
|
||||
toDelete[origin] = false
|
||||
|
||||
@@ -82,7 +82,7 @@ func (a Auto) Walk() error {
|
||||
|
||||
a.Zones.Remove(origin)
|
||||
|
||||
log.Printf("[INFO] Deleting zone `%s'", origin)
|
||||
log.Infof("Deleting zone `%s'", origin)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
@@ -2,7 +2,6 @@ package auto
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path"
|
||||
"regexp"
|
||||
@@ -20,8 +19,6 @@ www IN A 127.0.0.1
|
||||
`
|
||||
|
||||
func TestWalk(t *testing.T) {
|
||||
log.SetOutput(ioutil.Discard)
|
||||
|
||||
tempdir, err := createFiles()
|
||||
if err != nil {
|
||||
if tempdir != "" {
|
||||
@@ -53,8 +50,6 @@ func TestWalk(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestWalkNonExistent(t *testing.T) {
|
||||
log.SetOutput(ioutil.Discard)
|
||||
|
||||
nonExistingDir := "highly_unlikely_to_exist_dir"
|
||||
|
||||
ldr := loader{
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package auto
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path"
|
||||
"regexp"
|
||||
@@ -10,8 +8,6 @@ import (
|
||||
)
|
||||
|
||||
func TestWatcher(t *testing.T) {
|
||||
log.SetOutput(ioutil.Discard)
|
||||
|
||||
tempdir, err := createFiles()
|
||||
if err != nil {
|
||||
if tempdir != "" {
|
||||
|
||||
Reference in New Issue
Block a user