Browse code

Use logrus everywhere for logging

Fixed #8761

Signed-off-by: Alexandr Morozov <lk4d4@docker.com>

Alexandr Morozov authored on 2014/10/25 02:12:35
Showing 61 changed files
... ...
@@ -22,6 +22,7 @@ import (
22 22
 	"text/template"
23 23
 	"time"
24 24
 
25
+	log "github.com/Sirupsen/logrus"
25 26
 	"github.com/docker/docker/api"
26 27
 	"github.com/docker/docker/dockerversion"
27 28
 	"github.com/docker/docker/engine"
... ...
@@ -29,7 +30,6 @@ import (
29 29
 	"github.com/docker/docker/nat"
30 30
 	"github.com/docker/docker/opts"
31 31
 	"github.com/docker/docker/pkg/archive"
32
-	"github.com/docker/docker/pkg/log"
33 32
 	flag "github.com/docker/docker/pkg/mflag"
34 33
 	"github.com/docker/docker/pkg/parsers"
35 34
 	"github.com/docker/docker/pkg/parsers/filters"
... ...
@@ -11,9 +11,9 @@ import (
11 11
 	"runtime"
12 12
 	"strings"
13 13
 
14
+	log "github.com/Sirupsen/logrus"
14 15
 	"github.com/docker/docker/api"
15 16
 	"github.com/docker/docker/dockerversion"
16
-	"github.com/docker/docker/pkg/log"
17 17
 	"github.com/docker/docker/pkg/promise"
18 18
 	"github.com/docker/docker/pkg/stdcopy"
19 19
 	"github.com/docker/docker/pkg/term"
... ...
@@ -16,10 +16,10 @@ import (
16 16
 	"strings"
17 17
 	"syscall"
18 18
 
19
+	log "github.com/Sirupsen/logrus"
19 20
 	"github.com/docker/docker/api"
20 21
 	"github.com/docker/docker/dockerversion"
21 22
 	"github.com/docker/docker/engine"
22
-	"github.com/docker/docker/pkg/log"
23 23
 	"github.com/docker/docker/pkg/stdcopy"
24 24
 	"github.com/docker/docker/pkg/term"
25 25
 	"github.com/docker/docker/registry"
... ...
@@ -5,8 +5,8 @@ import (
5 5
 	"mime"
6 6
 	"strings"
7 7
 
8
+	log "github.com/Sirupsen/logrus"
8 9
 	"github.com/docker/docker/engine"
9
-	"github.com/docker/docker/pkg/log"
10 10
 	"github.com/docker/docker/pkg/parsers"
11 11
 	"github.com/docker/docker/pkg/version"
12 12
 )
... ...
@@ -23,10 +23,10 @@ import (
23 23
 	"github.com/docker/libcontainer/user"
24 24
 	"github.com/gorilla/mux"
25 25
 
26
+	log "github.com/Sirupsen/logrus"
26 27
 	"github.com/docker/docker/api"
27 28
 	"github.com/docker/docker/engine"
28 29
 	"github.com/docker/docker/pkg/listenbuffer"
29
-	"github.com/docker/docker/pkg/log"
30 30
 	"github.com/docker/docker/pkg/parsers"
31 31
 	"github.com/docker/docker/pkg/stdcopy"
32 32
 	"github.com/docker/docker/pkg/systemd"
... ...
@@ -14,8 +14,8 @@ import (
14 14
 	"regexp"
15 15
 	"strings"
16 16
 
17
+	log "github.com/Sirupsen/logrus"
17 18
 	"github.com/docker/docker/nat"
18
-	"github.com/docker/docker/pkg/log"
19 19
 	flag "github.com/docker/docker/pkg/mflag"
20 20
 	"github.com/docker/docker/runconfig"
21 21
 )
... ...
@@ -27,10 +27,10 @@ import (
27 27
 	"path"
28 28
 	"strings"
29 29
 
30
+	log "github.com/Sirupsen/logrus"
30 31
 	"github.com/docker/docker/builder/parser"
31 32
 	"github.com/docker/docker/daemon"
32 33
 	"github.com/docker/docker/engine"
33
-	"github.com/docker/docker/pkg/log"
34 34
 	"github.com/docker/docker/pkg/tarsum"
35 35
 	"github.com/docker/docker/registry"
36 36
 	"github.com/docker/docker/runconfig"
... ...
@@ -18,11 +18,11 @@ import (
18 18
 	"syscall"
19 19
 	"time"
20 20
 
21
+	log "github.com/Sirupsen/logrus"
21 22
 	"github.com/docker/docker/builder/parser"
22 23
 	"github.com/docker/docker/daemon"
23 24
 	imagepkg "github.com/docker/docker/image"
24 25
 	"github.com/docker/docker/pkg/archive"
25
-	"github.com/docker/docker/pkg/log"
26 26
 	"github.com/docker/docker/pkg/parsers"
27 27
 	"github.com/docker/docker/pkg/symlink"
28 28
 	"github.com/docker/docker/pkg/system"
... ...
@@ -9,7 +9,7 @@ import (
9 9
 	"github.com/docker/docker/engine"
10 10
 	"github.com/docker/docker/pkg/ioutils"
11 11
 	"github.com/docker/docker/pkg/jsonlog"
12
-	"github.com/docker/docker/pkg/log"
12
+	log "github.com/Sirupsen/logrus"
13 13
 	"github.com/docker/docker/pkg/promise"
14 14
 	"github.com/docker/docker/utils"
15 15
 )
... ...
@@ -25,7 +25,7 @@ import (
25 25
 	"github.com/docker/docker/pkg/archive"
26 26
 	"github.com/docker/docker/pkg/broadcastwriter"
27 27
 	"github.com/docker/docker/pkg/ioutils"
28
-	"github.com/docker/docker/pkg/log"
28
+	log "github.com/Sirupsen/logrus"
29 29
 	"github.com/docker/docker/pkg/networkfs/etchosts"
30 30
 	"github.com/docker/docker/pkg/networkfs/resolvconf"
31 31
 	"github.com/docker/docker/pkg/promise"
... ...
@@ -14,6 +14,7 @@ import (
14 14
 
15 15
 	"github.com/docker/libcontainer/label"
16 16
 
17
+	log "github.com/Sirupsen/logrus"
17 18
 	"github.com/docker/docker/daemon/execdriver"
18 19
 	"github.com/docker/docker/daemon/execdriver/execdrivers"
19 20
 	"github.com/docker/docker/daemon/execdriver/lxc"
... ...
@@ -29,7 +30,6 @@ import (
29 29
 	"github.com/docker/docker/pkg/broadcastwriter"
30 30
 	"github.com/docker/docker/pkg/graphdb"
31 31
 	"github.com/docker/docker/pkg/ioutils"
32
-	"github.com/docker/docker/pkg/log"
33 32
 	"github.com/docker/docker/pkg/namesgenerator"
34 33
 	"github.com/docker/docker/pkg/parsers"
35 34
 	"github.com/docker/docker/pkg/parsers/kernel"
... ...
@@ -304,7 +304,7 @@ func (daemon *Daemon) restore() error {
304 304
 	)
305 305
 
306 306
 	if !debug {
307
-		log.Infof("Loading containers: ")
307
+		log.Infof("Loading containers: start.")
308 308
 	}
309 309
 	dir, err := ioutil.ReadDir(daemon.repository)
310 310
 	if err != nil {
... ...
@@ -392,7 +392,8 @@ func (daemon *Daemon) restore() error {
392 392
 	}
393 393
 
394 394
 	if !debug {
395
-		log.Infof(": done.")
395
+		fmt.Println()
396
+		log.Infof("Loading containers: done.")
396 397
 	}
397 398
 
398 399
 	return nil
... ...
@@ -6,7 +6,7 @@ import (
6 6
 	"github.com/docker/docker/daemon/graphdriver"
7 7
 	"github.com/docker/docker/daemon/graphdriver/aufs"
8 8
 	"github.com/docker/docker/graph"
9
-	"github.com/docker/docker/pkg/log"
9
+	log "github.com/Sirupsen/logrus"
10 10
 )
11 11
 
12 12
 // Given the graphdriver ad, if it is aufs, then migrate it.
... ...
@@ -6,7 +6,7 @@ import (
6 6
 	"path"
7 7
 
8 8
 	"github.com/docker/docker/engine"
9
-	"github.com/docker/docker/pkg/log"
9
+	log "github.com/Sirupsen/logrus"
10 10
 )
11 11
 
12 12
 func (daemon *Daemon) ContainerRm(job *engine.Job) engine.Status {
... ...
@@ -14,7 +14,7 @@ import (
14 14
 	"github.com/docker/docker/engine"
15 15
 	"github.com/docker/docker/pkg/broadcastwriter"
16 16
 	"github.com/docker/docker/pkg/ioutils"
17
-	"github.com/docker/docker/pkg/log"
17
+	log "github.com/Sirupsen/logrus"
18 18
 	"github.com/docker/docker/pkg/promise"
19 19
 	"github.com/docker/docker/runconfig"
20 20
 	"github.com/docker/docker/utils"
... ...
@@ -18,7 +18,7 @@ import (
18 18
 	"github.com/kr/pty"
19 19
 
20 20
 	"github.com/docker/docker/daemon/execdriver"
21
-	"github.com/docker/docker/pkg/log"
21
+	log "github.com/Sirupsen/logrus"
22 22
 	"github.com/docker/docker/pkg/term"
23 23
 	"github.com/docker/docker/utils"
24 24
 	"github.com/docker/libcontainer/cgroups"
... ...
@@ -32,7 +32,7 @@ import (
32 32
 
33 33
 	"github.com/docker/docker/daemon/graphdriver"
34 34
 	"github.com/docker/docker/pkg/archive"
35
-	"github.com/docker/docker/pkg/log"
35
+	log "github.com/Sirupsen/logrus"
36 36
 	mountpk "github.com/docker/docker/pkg/mount"
37 37
 	"github.com/docker/docker/utils"
38 38
 	"github.com/docker/libcontainer/label"
... ...
@@ -4,7 +4,7 @@ import (
4 4
 	"os/exec"
5 5
 	"syscall"
6 6
 
7
-	"github.com/docker/docker/pkg/log"
7
+	log "github.com/Sirupsen/logrus"
8 8
 )
9 9
 
10 10
 func Unmount(target string) error {
... ...
@@ -7,7 +7,7 @@ import (
7 7
 	"os"
8 8
 	"syscall"
9 9
 
10
-	"github.com/docker/docker/pkg/log"
10
+	log "github.com/Sirupsen/logrus"
11 11
 )
12 12
 
13 13
 func stringToLoopName(src string) [LoNameSize]uint8 {
... ...
@@ -19,7 +19,7 @@ import (
19 19
 	"time"
20 20
 
21 21
 	"github.com/docker/docker/daemon/graphdriver"
22
-	"github.com/docker/docker/pkg/log"
22
+	log "github.com/Sirupsen/logrus"
23 23
 	"github.com/docker/docker/pkg/parsers"
24 24
 	"github.com/docker/docker/pkg/units"
25 25
 	"github.com/docker/libcontainer/label"
... ...
@@ -9,7 +9,7 @@ import (
9 9
 	"runtime"
10 10
 	"syscall"
11 11
 
12
-	"github.com/docker/docker/pkg/log"
12
+	log "github.com/Sirupsen/logrus"
13 13
 )
14 14
 
15 15
 type DevmapperLogger interface {
... ...
@@ -9,7 +9,7 @@ import (
9 9
 	"path"
10 10
 
11 11
 	"github.com/docker/docker/daemon/graphdriver"
12
-	"github.com/docker/docker/pkg/log"
12
+	log "github.com/Sirupsen/logrus"
13 13
 	"github.com/docker/docker/pkg/mount"
14 14
 	"github.com/docker/docker/pkg/units"
15 15
 )
... ...
@@ -6,7 +6,7 @@ import (
6 6
 
7 7
 	"github.com/docker/docker/pkg/archive"
8 8
 	"github.com/docker/docker/pkg/ioutils"
9
-	"github.com/docker/docker/pkg/log"
9
+	log "github.com/Sirupsen/logrus"
10 10
 	"github.com/docker/docker/utils"
11 11
 )
12 12
 
... ...
@@ -6,7 +6,7 @@ import (
6 6
 
7 7
 	"github.com/docker/docker/dockerversion"
8 8
 	"github.com/docker/docker/engine"
9
-	"github.com/docker/docker/pkg/log"
9
+	log "github.com/Sirupsen/logrus"
10 10
 	"github.com/docker/docker/pkg/parsers/kernel"
11 11
 	"github.com/docker/docker/pkg/parsers/operatingsystem"
12 12
 	"github.com/docker/docker/registry"
... ...
@@ -10,7 +10,7 @@ import (
10 10
 
11 11
 	"github.com/docker/docker/engine"
12 12
 	"github.com/docker/docker/pkg/jsonlog"
13
-	"github.com/docker/docker/pkg/log"
13
+	log "github.com/Sirupsen/logrus"
14 14
 	"github.com/docker/docker/pkg/tailfile"
15 15
 	"github.com/docker/docker/pkg/timeutils"
16 16
 )
... ...
@@ -7,7 +7,7 @@ import (
7 7
 	"time"
8 8
 
9 9
 	"github.com/docker/docker/daemon/execdriver"
10
-	"github.com/docker/docker/pkg/log"
10
+	log "github.com/Sirupsen/logrus"
11 11
 	"github.com/docker/docker/runconfig"
12 12
 )
13 13
 
... ...
@@ -14,7 +14,7 @@ import (
14 14
 	"github.com/docker/docker/daemon/networkdriver/portmapper"
15 15
 	"github.com/docker/docker/engine"
16 16
 	"github.com/docker/docker/pkg/iptables"
17
-	"github.com/docker/docker/pkg/log"
17
+	log "github.com/Sirupsen/logrus"
18 18
 	"github.com/docker/docker/pkg/networkfs/resolvconf"
19 19
 	"github.com/docker/docker/pkg/parsers/kernel"
20 20
 	"github.com/docker/libcontainer/netlink"
... ...
@@ -8,7 +8,7 @@ import (
8 8
 
9 9
 	"github.com/docker/docker/daemon/networkdriver/portallocator"
10 10
 	"github.com/docker/docker/pkg/iptables"
11
-	"github.com/docker/docker/pkg/log"
11
+	log "github.com/Sirupsen/logrus"
12 12
 )
13 13
 
14 14
 type mapping struct {
... ...
@@ -12,7 +12,7 @@ import (
12 12
 
13 13
 	"github.com/docker/docker/daemon/execdriver"
14 14
 	"github.com/docker/docker/pkg/archive"
15
-	"github.com/docker/docker/pkg/log"
15
+	log "github.com/Sirupsen/logrus"
16 16
 	"github.com/docker/docker/pkg/symlink"
17 17
 	"github.com/docker/docker/volumes"
18 18
 )
... ...
@@ -3,6 +3,7 @@
3 3
 package main
4 4
 
5 5
 import (
6
+	log "github.com/Sirupsen/logrus"
6 7
 	"github.com/docker/docker/builder"
7 8
 	"github.com/docker/docker/builtins"
8 9
 	"github.com/docker/docker/daemon"
... ...
@@ -10,7 +11,6 @@ import (
10 10
 	_ "github.com/docker/docker/daemon/execdriver/native"
11 11
 	"github.com/docker/docker/dockerversion"
12 12
 	"github.com/docker/docker/engine"
13
-	"github.com/docker/docker/pkg/log"
14 13
 	flag "github.com/docker/docker/pkg/mflag"
15 14
 	"github.com/docker/docker/pkg/signal"
16 15
 )
... ...
@@ -28,6 +28,7 @@ func main() {
28 28
 	if reexec.Init() {
29 29
 		return
30 30
 	}
31
+
31 32
 	flag.Parse()
32 33
 	// FIXME: validate daemon flags here
33 34
 
... ...
@@ -39,6 +40,8 @@ func main() {
39 39
 		os.Setenv("DEBUG", "1")
40 40
 	}
41 41
 
42
+	initLogging(*flDebug)
43
+
42 44
 	if len(flHosts) == 0 {
43 45
 		defaultHost := os.Getenv("DOCKER_HOST")
44 46
 		if defaultHost == "" || *flDaemon {
45 47
new file mode 100644
... ...
@@ -0,0 +1,16 @@
0
+package main
1
+
2
+import (
3
+	"os"
4
+
5
+	log "github.com/Sirupsen/logrus"
6
+)
7
+
8
+func initLogging(debug bool) {
9
+	log.SetOutput(os.Stderr)
10
+	if debug {
11
+		log.SetLevel(log.DebugLevel)
12
+	} else {
13
+		log.SetLevel(log.InfoLevel)
14
+	}
15
+}
... ...
@@ -9,7 +9,7 @@ import (
9 9
 
10 10
 	"github.com/docker/docker/engine"
11 11
 	"github.com/docker/docker/pkg/archive"
12
-	"github.com/docker/docker/pkg/log"
12
+	log "github.com/Sirupsen/logrus"
13 13
 	"github.com/docker/docker/pkg/parsers"
14 14
 )
15 15
 
... ...
@@ -16,7 +16,7 @@ import (
16 16
 	"github.com/docker/docker/dockerversion"
17 17
 	"github.com/docker/docker/image"
18 18
 	"github.com/docker/docker/pkg/archive"
19
-	"github.com/docker/docker/pkg/log"
19
+	log "github.com/Sirupsen/logrus"
20 20
 	"github.com/docker/docker/pkg/truncindex"
21 21
 	"github.com/docker/docker/runconfig"
22 22
 	"github.com/docker/docker/utils"
... ...
@@ -10,7 +10,7 @@ import (
10 10
 	"github.com/docker/docker/engine"
11 11
 	"github.com/docker/docker/image"
12 12
 	"github.com/docker/docker/pkg/archive"
13
-	"github.com/docker/docker/pkg/log"
13
+	log "github.com/Sirupsen/logrus"
14 14
 )
15 15
 
16 16
 // Loads a set of images into the repository. This is the complementary of ImageExport.
... ...
@@ -14,7 +14,7 @@ import (
14 14
 
15 15
 	"github.com/docker/docker/engine"
16 16
 	"github.com/docker/docker/image"
17
-	"github.com/docker/docker/pkg/log"
17
+	log "github.com/Sirupsen/logrus"
18 18
 	"github.com/docker/docker/registry"
19 19
 	"github.com/docker/docker/utils"
20 20
 	"github.com/docker/libtrust"
... ...
@@ -9,7 +9,7 @@ import (
9 9
 
10 10
 	"github.com/docker/docker/engine"
11 11
 	"github.com/docker/docker/pkg/archive"
12
-	"github.com/docker/docker/pkg/log"
12
+	log "github.com/Sirupsen/logrus"
13 13
 	"github.com/docker/docker/registry"
14 14
 	"github.com/docker/docker/utils"
15 15
 )
... ...
@@ -6,7 +6,7 @@ import (
6 6
 
7 7
 	"github.com/docker/docker/engine"
8 8
 	"github.com/docker/docker/image"
9
-	"github.com/docker/docker/pkg/log"
9
+	log "github.com/Sirupsen/logrus"
10 10
 )
11 11
 
12 12
 func (s *TagStore) Install(eng *engine.Engine) error {
... ...
@@ -10,7 +10,7 @@ import (
10 10
 	"time"
11 11
 
12 12
 	"github.com/docker/docker/pkg/archive"
13
-	"github.com/docker/docker/pkg/log"
13
+	log "github.com/Sirupsen/logrus"
14 14
 	"github.com/docker/docker/runconfig"
15 15
 	"github.com/docker/docker/utils"
16 16
 )
... ...
@@ -11,7 +11,7 @@ import (
11 11
 
12 12
 	"github.com/docker/docker/api/client"
13 13
 	"github.com/docker/docker/daemon"
14
-	"github.com/docker/docker/pkg/log"
14
+	log "github.com/Sirupsen/logrus"
15 15
 	"github.com/docker/docker/pkg/term"
16 16
 	"github.com/docker/docker/utils"
17 17
 	"github.com/docker/libtrust"
... ...
@@ -21,7 +21,7 @@ import (
21 21
 	"github.com/docker/docker/image"
22 22
 	"github.com/docker/docker/nat"
23 23
 	"github.com/docker/docker/pkg/ioutils"
24
-	"github.com/docker/docker/pkg/log"
24
+	log "github.com/Sirupsen/logrus"
25 25
 	"github.com/docker/docker/reexec"
26 26
 	"github.com/docker/docker/runconfig"
27 27
 	"github.com/docker/docker/utils"
... ...
@@ -18,20 +18,23 @@ import (
18 18
 	"github.com/docker/docker/builtins"
19 19
 	"github.com/docker/docker/daemon"
20 20
 	"github.com/docker/docker/engine"
21
-	"github.com/docker/docker/pkg/log"
22 21
 	flag "github.com/docker/docker/pkg/mflag"
23 22
 	"github.com/docker/docker/pkg/sysinfo"
24 23
 	"github.com/docker/docker/runconfig"
25 24
 	"github.com/docker/docker/utils"
26 25
 )
27 26
 
27
+type Fataler interface {
28
+	Fatal(...interface{})
29
+}
30
+
28 31
 // This file contains utility functions for docker's unit test suite.
29 32
 // It has to be named XXX_test.go, apparently, in other to access private functions
30 33
 // from other XXX_test.go functions.
31 34
 
32 35
 // Create a temporary daemon suitable for unit testing.
33 36
 // Call t.Fatal() at the first error.
34
-func mkDaemon(f log.Fataler) *daemon.Daemon {
37
+func mkDaemon(f Fataler) *daemon.Daemon {
35 38
 	eng := newTestEngine(f, false, "")
36 39
 	return mkDaemonFromEngine(eng, f)
37 40
 	// FIXME:
... ...
@@ -40,7 +43,7 @@ func mkDaemon(f log.Fataler) *daemon.Daemon {
40 40
 	// [...]
41 41
 }
42 42
 
43
-func createNamedTestContainer(eng *engine.Engine, config *runconfig.Config, f log.Fataler, name string) (shortId string) {
43
+func createNamedTestContainer(eng *engine.Engine, config *runconfig.Config, f Fataler, name string) (shortId string) {
44 44
 	job := eng.Job("create", name)
45 45
 	if err := job.ImportEnv(config); err != nil {
46 46
 		f.Fatal(err)
... ...
@@ -53,23 +56,23 @@ func createNamedTestContainer(eng *engine.Engine, config *runconfig.Config, f lo
53 53
 	return engine.Tail(outputBuffer, 1)
54 54
 }
55 55
 
56
-func createTestContainer(eng *engine.Engine, config *runconfig.Config, f log.Fataler) (shortId string) {
56
+func createTestContainer(eng *engine.Engine, config *runconfig.Config, f Fataler) (shortId string) {
57 57
 	return createNamedTestContainer(eng, config, f, "")
58 58
 }
59 59
 
60
-func startContainer(eng *engine.Engine, id string, t log.Fataler) {
60
+func startContainer(eng *engine.Engine, id string, t Fataler) {
61 61
 	job := eng.Job("start", id)
62 62
 	if err := job.Run(); err != nil {
63 63
 		t.Fatal(err)
64 64
 	}
65 65
 }
66 66
 
67
-func containerRun(eng *engine.Engine, id string, t log.Fataler) {
67
+func containerRun(eng *engine.Engine, id string, t Fataler) {
68 68
 	startContainer(eng, id, t)
69 69
 	containerWait(eng, id, t)
70 70
 }
71 71
 
72
-func containerFileExists(eng *engine.Engine, id, dir string, t log.Fataler) bool {
72
+func containerFileExists(eng *engine.Engine, id, dir string, t Fataler) bool {
73 73
 	c := getContainer(eng, id, t)
74 74
 	if err := c.Mount(); err != nil {
75 75
 		t.Fatal(err)
... ...
@@ -84,7 +87,7 @@ func containerFileExists(eng *engine.Engine, id, dir string, t log.Fataler) bool
84 84
 	return true
85 85
 }
86 86
 
87
-func containerAttach(eng *engine.Engine, id string, t log.Fataler) (io.WriteCloser, io.ReadCloser) {
87
+func containerAttach(eng *engine.Engine, id string, t Fataler) (io.WriteCloser, io.ReadCloser) {
88 88
 	c := getContainer(eng, id, t)
89 89
 	i, err := c.StdinPipe()
90 90
 	if err != nil {
... ...
@@ -97,31 +100,31 @@ func containerAttach(eng *engine.Engine, id string, t log.Fataler) (io.WriteClos
97 97
 	return i, o
98 98
 }
99 99
 
100
-func containerWait(eng *engine.Engine, id string, t log.Fataler) int {
100
+func containerWait(eng *engine.Engine, id string, t Fataler) int {
101 101
 	ex, _ := getContainer(eng, id, t).WaitStop(-1 * time.Second)
102 102
 	return ex
103 103
 }
104 104
 
105
-func containerWaitTimeout(eng *engine.Engine, id string, t log.Fataler) error {
105
+func containerWaitTimeout(eng *engine.Engine, id string, t Fataler) error {
106 106
 	_, err := getContainer(eng, id, t).WaitStop(500 * time.Millisecond)
107 107
 	return err
108 108
 }
109 109
 
110
-func containerKill(eng *engine.Engine, id string, t log.Fataler) {
110
+func containerKill(eng *engine.Engine, id string, t Fataler) {
111 111
 	if err := eng.Job("kill", id).Run(); err != nil {
112 112
 		t.Fatal(err)
113 113
 	}
114 114
 }
115 115
 
116
-func containerRunning(eng *engine.Engine, id string, t log.Fataler) bool {
116
+func containerRunning(eng *engine.Engine, id string, t Fataler) bool {
117 117
 	return getContainer(eng, id, t).IsRunning()
118 118
 }
119 119
 
120
-func containerAssertExists(eng *engine.Engine, id string, t log.Fataler) {
120
+func containerAssertExists(eng *engine.Engine, id string, t Fataler) {
121 121
 	getContainer(eng, id, t)
122 122
 }
123 123
 
124
-func containerAssertNotExists(eng *engine.Engine, id string, t log.Fataler) {
124
+func containerAssertNotExists(eng *engine.Engine, id string, t Fataler) {
125 125
 	daemon := mkDaemonFromEngine(eng, t)
126 126
 	if c := daemon.Get(id); c != nil {
127 127
 		t.Fatal(fmt.Errorf("Container %s should not exist", id))
... ...
@@ -130,7 +133,7 @@ func containerAssertNotExists(eng *engine.Engine, id string, t log.Fataler) {
130 130
 
131 131
 // assertHttpNotError expect the given response to not have an error.
132 132
 // Otherwise the it causes the test to fail.
133
-func assertHttpNotError(r *httptest.ResponseRecorder, t log.Fataler) {
133
+func assertHttpNotError(r *httptest.ResponseRecorder, t Fataler) {
134 134
 	// Non-error http status are [200, 400)
135 135
 	if r.Code < http.StatusOK || r.Code >= http.StatusBadRequest {
136 136
 		t.Fatal(fmt.Errorf("Unexpected http error: %v", r.Code))
... ...
@@ -139,14 +142,14 @@ func assertHttpNotError(r *httptest.ResponseRecorder, t log.Fataler) {
139 139
 
140 140
 // assertHttpError expect the given response to have an error.
141 141
 // Otherwise the it causes the test to fail.
142
-func assertHttpError(r *httptest.ResponseRecorder, t log.Fataler) {
142
+func assertHttpError(r *httptest.ResponseRecorder, t Fataler) {
143 143
 	// Non-error http status are [200, 400)
144 144
 	if !(r.Code < http.StatusOK || r.Code >= http.StatusBadRequest) {
145 145
 		t.Fatal(fmt.Errorf("Unexpected http success code: %v", r.Code))
146 146
 	}
147 147
 }
148 148
 
149
-func getContainer(eng *engine.Engine, id string, t log.Fataler) *daemon.Container {
149
+func getContainer(eng *engine.Engine, id string, t Fataler) *daemon.Container {
150 150
 	daemon := mkDaemonFromEngine(eng, t)
151 151
 	c := daemon.Get(id)
152 152
 	if c == nil {
... ...
@@ -155,7 +158,7 @@ func getContainer(eng *engine.Engine, id string, t log.Fataler) *daemon.Containe
155 155
 	return c
156 156
 }
157 157
 
158
-func mkDaemonFromEngine(eng *engine.Engine, t log.Fataler) *daemon.Daemon {
158
+func mkDaemonFromEngine(eng *engine.Engine, t Fataler) *daemon.Daemon {
159 159
 	iDaemon := eng.Hack_GetGlobalVar("httpapi.daemon")
160 160
 	if iDaemon == nil {
161 161
 		panic("Legacy daemon field not set in engine")
... ...
@@ -167,7 +170,7 @@ func mkDaemonFromEngine(eng *engine.Engine, t log.Fataler) *daemon.Daemon {
167 167
 	return daemon
168 168
 }
169 169
 
170
-func newTestEngine(t log.Fataler, autorestart bool, root string) *engine.Engine {
170
+func newTestEngine(t Fataler, autorestart bool, root string) *engine.Engine {
171 171
 	if root == "" {
172 172
 		if dir, err := newTestDirectory(unitTestStoreBase); err != nil {
173 173
 			t.Fatal(err)
... ...
@@ -200,7 +203,7 @@ func newTestEngine(t log.Fataler, autorestart bool, root string) *engine.Engine
200 200
 	return eng
201 201
 }
202 202
 
203
-func NewTestEngine(t log.Fataler) *engine.Engine {
203
+func NewTestEngine(t Fataler) *engine.Engine {
204 204
 	return newTestEngine(t, false, "")
205 205
 }
206 206
 
... ...
@@ -19,7 +19,7 @@ import (
19 19
 	"github.com/docker/docker/vendor/src/code.google.com/p/go/src/pkg/archive/tar"
20 20
 
21 21
 	"github.com/docker/docker/pkg/fileutils"
22
-	"github.com/docker/docker/pkg/log"
22
+	log "github.com/Sirupsen/logrus"
23 23
 	"github.com/docker/docker/pkg/pools"
24 24
 	"github.com/docker/docker/pkg/promise"
25 25
 	"github.com/docker/docker/pkg/system"
... ...
@@ -12,7 +12,7 @@ import (
12 12
 
13 13
 	"github.com/docker/docker/vendor/src/code.google.com/p/go/src/pkg/archive/tar"
14 14
 
15
-	"github.com/docker/docker/pkg/log"
15
+	log "github.com/Sirupsen/logrus"
16 16
 	"github.com/docker/docker/pkg/pools"
17 17
 	"github.com/docker/docker/pkg/system"
18 18
 )
... ...
@@ -7,7 +7,7 @@ import (
7 7
 	"time"
8 8
 
9 9
 	"github.com/docker/docker/pkg/jsonlog"
10
-	"github.com/docker/docker/pkg/log"
10
+	log "github.com/Sirupsen/logrus"
11 11
 )
12 12
 
13 13
 // BroadcastWriter accumulate multiple io.WriteCloser by stream.
... ...
@@ -1,7 +1,7 @@
1 1
 package fileutils
2 2
 
3 3
 import (
4
-	"github.com/docker/docker/pkg/log"
4
+	log "github.com/Sirupsen/logrus"
5 5
 	"path/filepath"
6 6
 )
7 7
 
... ...
@@ -6,7 +6,7 @@ import (
6 6
 	"net/http"
7 7
 	"time"
8 8
 
9
-	"github.com/docker/docker/pkg/log"
9
+	log "github.com/Sirupsen/logrus"
10 10
 )
11 11
 
12 12
 type resumableRequestReader struct {
... ...
@@ -9,7 +9,7 @@ import (
9 9
 	"strconv"
10 10
 	"strings"
11 11
 
12
-	"github.com/docker/docker/pkg/log"
12
+	log "github.com/Sirupsen/logrus"
13 13
 )
14 14
 
15 15
 type Action string
... ...
@@ -8,9 +8,18 @@ import (
8 8
 	"strings"
9 9
 	"time"
10 10
 
11
+	log "github.com/Sirupsen/logrus"
11 12
 	"github.com/docker/docker/pkg/timeutils"
12 13
 )
13 14
 
15
+func init() {
16
+	log.SetOutput(os.Stderr)
17
+	log.SetLevel(log.InfoLevel)
18
+	if os.Getenv("DEBUG") != "" {
19
+		log.SetLevel(log.DebugLevel)
20
+	}
21
+}
22
+
14 23
 type priority int
15 24
 
16 25
 const (
... ...
@@ -6,7 +6,7 @@ import (
6 6
 	"sync/atomic"
7 7
 	"syscall"
8 8
 
9
-	"github.com/docker/docker/pkg/log"
9
+	log "github.com/Sirupsen/logrus"
10 10
 )
11 11
 
12 12
 // Trap sets up a simplified signal "trap", appropriate for common
... ...
@@ -5,7 +5,7 @@ import (
5 5
 	"errors"
6 6
 	"io"
7 7
 
8
-	"github.com/docker/docker/pkg/log"
8
+	log "github.com/Sirupsen/logrus"
9 9
 )
10 10
 
11 11
 const (
... ...
@@ -13,7 +13,7 @@ import (
13 13
 
14 14
 	"github.com/docker/docker/vendor/src/code.google.com/p/go/src/pkg/archive/tar"
15 15
 
16
-	"github.com/docker/docker/pkg/log"
16
+	log "github.com/Sirupsen/logrus"
17 17
 )
18 18
 
19 19
 const (
... ...
@@ -9,7 +9,7 @@ import (
9 9
 	"net/url"
10 10
 	"strings"
11 11
 
12
-	"github.com/docker/docker/pkg/log"
12
+	log "github.com/Sirupsen/logrus"
13 13
 )
14 14
 
15 15
 // scans string for api version in the URL path. returns the trimmed hostname, if version found, string and API version.
... ...
@@ -15,7 +15,7 @@ import (
15 15
 
16 16
 	"github.com/gorilla/mux"
17 17
 
18
-	"github.com/docker/docker/pkg/log"
18
+	log "github.com/Sirupsen/logrus"
19 19
 )
20 20
 
21 21
 var (
... ...
@@ -18,7 +18,7 @@ import (
18 18
 	"time"
19 19
 
20 20
 	"github.com/docker/docker/pkg/httputils"
21
-	"github.com/docker/docker/pkg/log"
21
+	log "github.com/Sirupsen/logrus"
22 22
 	"github.com/docker/docker/pkg/tarsum"
23 23
 	"github.com/docker/docker/utils"
24 24
 )
... ...
@@ -8,7 +8,7 @@ import (
8 8
 	"net/url"
9 9
 	"strconv"
10 10
 
11
-	"github.com/docker/docker/pkg/log"
11
+	log "github.com/Sirupsen/logrus"
12 12
 	"github.com/docker/docker/utils"
13 13
 	"github.com/gorilla/mux"
14 14
 )
... ...
@@ -4,7 +4,7 @@ import (
4 4
 	"strings"
5 5
 
6 6
 	"github.com/docker/docker/nat"
7
-	"github.com/docker/docker/pkg/log"
7
+	log "github.com/Sirupsen/logrus"
8 8
 )
9 9
 
10 10
 func Merge(userConf, imageConf *Config) error {
... ...
@@ -5,7 +5,7 @@ import (
5 5
 	"time"
6 6
 
7 7
 	"github.com/docker/docker/engine"
8
-	"github.com/docker/docker/pkg/log"
8
+	log "github.com/Sirupsen/logrus"
9 9
 	"github.com/docker/libtrust"
10 10
 )
11 11
 
... ...
@@ -12,7 +12,7 @@ import (
12 12
 	"sync"
13 13
 	"time"
14 14
 
15
-	"github.com/docker/docker/pkg/log"
15
+	log "github.com/Sirupsen/logrus"
16 16
 	"github.com/docker/libtrust/trustgraph"
17 17
 )
18 18
 
... ...
@@ -5,7 +5,7 @@ import (
5 5
 	"net/http"
6 6
 	"strings"
7 7
 
8
-	"github.com/docker/docker/pkg/log"
8
+	log "github.com/Sirupsen/logrus"
9 9
 )
10 10
 
11 11
 // VersionInfo is used to model entities which has a version.
... ...
@@ -23,7 +23,7 @@ import (
23 23
 	"github.com/docker/docker/dockerversion"
24 24
 	"github.com/docker/docker/pkg/fileutils"
25 25
 	"github.com/docker/docker/pkg/ioutils"
26
-	"github.com/docker/docker/pkg/log"
26
+	log "github.com/Sirupsen/logrus"
27 27
 )
28 28
 
29 29
 type KeyValuePair struct {
... ...
@@ -8,7 +8,7 @@ import (
8 8
 	"sync"
9 9
 
10 10
 	"github.com/docker/docker/daemon/graphdriver"
11
-	"github.com/docker/docker/pkg/log"
11
+	log "github.com/Sirupsen/logrus"
12 12
 	"github.com/docker/docker/utils"
13 13
 )
14 14