aboutsummaryrefslogtreecommitdiff
path: root/plugin/auto
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/auto')
-rw-r--r--plugin/auto/setup.go4
-rw-r--r--plugin/auto/walk.go10
-rw-r--r--plugin/auto/walk_test.go5
-rw-r--r--plugin/auto/watcher_test.go4
4 files changed, 7 insertions, 16 deletions
diff --git a/plugin/auto/setup.go b/plugin/auto/setup.go
index c4ccf1900..ddb2c2d2a 100644
--- a/plugin/auto/setup.go
+++ b/plugin/auto/setup.go
@@ -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)
}
diff --git a/plugin/auto/walk.go b/plugin/auto/walk.go
index fa07e6aeb..6ad06569f 100644
--- a/plugin/auto/walk.go
+++ b/plugin/auto/walk.go
@@ -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
diff --git a/plugin/auto/walk_test.go b/plugin/auto/walk_test.go
index 29b9dbb55..7549f8634 100644
--- a/plugin/auto/walk_test.go
+++ b/plugin/auto/walk_test.go
@@ -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{
diff --git a/plugin/auto/watcher_test.go b/plugin/auto/watcher_test.go
index 329d8dc85..dde7053fd 100644
--- a/plugin/auto/watcher_test.go
+++ b/plugin/auto/watcher_test.go
@@ -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 != "" {