Browse code

Fix log to logrus

Signed-off-by: John Howard <jhoward@microsoft.com>

John Howard authored on 2015/07/29 11:58:50
Showing 4 changed files
... ...
@@ -13,7 +13,7 @@ import (
13 13
 	"syscall"
14 14
 	"time"
15 15
 
16
-	log "github.com/Sirupsen/logrus"
16
+	"github.com/Sirupsen/logrus"
17 17
 	"github.com/docker/docker/daemon/graphdriver"
18 18
 	"github.com/docker/docker/pkg/mount"
19 19
 	"github.com/docker/docker/pkg/parsers"
... ...
@@ -33,20 +33,20 @@ func init() {
33 33
 type Logger struct{}
34 34
 
35 35
 func (*Logger) Log(cmd []string) {
36
-	log.Debugf("[zfs] %s", strings.Join(cmd, " "))
36
+	logrus.Debugf("[zfs] %s", strings.Join(cmd, " "))
37 37
 }
38 38
 
39 39
 func Init(base string, opt []string) (graphdriver.Driver, error) {
40 40
 	var err error
41 41
 
42 42
 	if _, err := exec.LookPath("zfs"); err != nil {
43
-		log.Debugf("[zfs] zfs command is not available: %v", err)
43
+		logrus.Debugf("[zfs] zfs command is not available: %v", err)
44 44
 		return nil, graphdriver.ErrPrerequisites
45 45
 	}
46 46
 
47 47
 	file, err := os.OpenFile("/dev/zfs", os.O_RDWR, 600)
48 48
 	if err != nil {
49
-		log.Debugf("[zfs] cannot open /dev/zfs: %v", err)
49
+		logrus.Debugf("[zfs] cannot open /dev/zfs: %v", err)
50 50
 		return nil, graphdriver.ErrPrerequisites
51 51
 	}
52 52
 	defer file.Close()
... ...
@@ -133,7 +133,7 @@ func lookupZfsDataset(rootdir string) (string, error) {
133 133
 	}
134 134
 	for _, m := range mounts {
135 135
 		if err := syscall.Stat(m.Mountpoint, &stat); err != nil {
136
-			log.Debugf("[zfs] failed to stat '%s' while scanning for zfs mount: %v", m.Mountpoint, err)
136
+			logrus.Debugf("[zfs] failed to stat '%s' while scanning for zfs mount: %v", m.Mountpoint, err)
137 137
 			continue // may fail on fuse file systems
138 138
 		}
139 139
 
... ...
@@ -277,7 +277,7 @@ func (d *Driver) Get(id, mountLabel string) (string, error) {
277 277
 	mountpoint := d.MountPath(id)
278 278
 	filesystem := d.ZfsPath(id)
279 279
 	options := label.FormatMountLabel("", mountLabel)
280
-	log.Debugf(`[zfs] mount("%s", "%s", "%s")`, filesystem, mountpoint, options)
280
+	logrus.Debugf(`[zfs] mount("%s", "%s", "%s")`, filesystem, mountpoint, options)
281 281
 
282 282
 	// Create the target directories if they don't exist
283 283
 	if err := os.MkdirAll(mountpoint, 0755); err != nil && !os.IsExist(err) {
... ...
@@ -294,7 +294,7 @@ func (d *Driver) Get(id, mountLabel string) (string, error) {
294 294
 
295 295
 func (d *Driver) Put(id string) error {
296 296
 	mountpoint := d.MountPath(id)
297
-	log.Debugf(`[zfs] unmount("%s")`, mountpoint)
297
+	logrus.Debugf(`[zfs] unmount("%s")`, mountpoint)
298 298
 
299 299
 	if err := mount.Unmount(mountpoint); err != nil {
300 300
 		return fmt.Errorf("error unmounting to %s: %v", mountpoint, err)
... ...
@@ -5,7 +5,7 @@ import (
5 5
 	"strings"
6 6
 	"syscall"
7 7
 
8
-	log "github.com/Sirupsen/logrus"
8
+	"github.com/Sirupsen/logrus"
9 9
 	"github.com/docker/docker/daemon/graphdriver"
10 10
 )
11 11
 
... ...
@@ -17,7 +17,7 @@ func checkRootdirFs(rootdir string) error {
17 17
 
18 18
 	// on FreeBSD buf.Fstypename contains ['z', 'f', 's', 0 ... ]
19 19
 	if (buf.Fstypename[0] != 122) || (buf.Fstypename[1] != 102) || (buf.Fstypename[2] != 115) || (buf.Fstypename[3] != 0) {
20
-		log.Debugf("[zfs] no zfs dataset found for rootdir '%s'", rootdir)
20
+		logrus.Debugf("[zfs] no zfs dataset found for rootdir '%s'", rootdir)
21 21
 		return graphdriver.ErrPrerequisites
22 22
 	}
23 23
 
... ...
@@ -4,7 +4,7 @@ import (
4 4
 	"fmt"
5 5
 	"syscall"
6 6
 
7
-	log "github.com/Sirupsen/logrus"
7
+	"github.com/Sirupsen/logrus"
8 8
 	"github.com/docker/docker/daemon/graphdriver"
9 9
 )
10 10
 
... ...
@@ -15,7 +15,7 @@ func checkRootdirFs(rootdir string) error {
15 15
 	}
16 16
 
17 17
 	if graphdriver.FsMagic(buf.Type) != graphdriver.FsMagicZfs {
18
-		log.Debugf("[zfs] no zfs dataset found for rootdir '%s'", rootdir)
18
+		logrus.Debugf("[zfs] no zfs dataset found for rootdir '%s'", rootdir)
19 19
 		return graphdriver.ErrPrerequisites
20 20
 	}
21 21
 
... ...
@@ -10,7 +10,7 @@ import (
10 10
 	"path/filepath"
11 11
 	"strings"
12 12
 
13
-	log "github.com/Sirupsen/logrus"
13
+	"github.com/Sirupsen/logrus"
14 14
 )
15 15
 
16 16
 // Errors used or returned by this file.
... ...
@@ -121,7 +121,7 @@ func TarResource(sourcePath string) (content Archive, err error) {
121 121
 
122 122
 	filter := []string{sourceBase}
123 123
 
124
-	log.Debugf("copying %q from %q", sourceBase, sourceDir)
124
+	logrus.Debugf("copying %q from %q", sourceBase, sourceDir)
125 125
 
126 126
 	return TarWithOptions(sourceDir, &TarOptions{
127 127
 		Compression:      Uncompressed,