1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Use logrus everywhere for logging

Fixed #8761

Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
This commit is contained in:
Alexandr Morozov 2014-10-24 10:12:35 -07:00
parent 6229a36432
commit 7c62cee51e
61 changed files with 111 additions and 79 deletions

View file

@ -22,6 +22,7 @@ import (
"text/template" "text/template"
"time" "time"
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/api" "github.com/docker/docker/api"
"github.com/docker/docker/dockerversion" "github.com/docker/docker/dockerversion"
"github.com/docker/docker/engine" "github.com/docker/docker/engine"
@ -29,7 +30,6 @@ import (
"github.com/docker/docker/nat" "github.com/docker/docker/nat"
"github.com/docker/docker/opts" "github.com/docker/docker/opts"
"github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/log"
flag "github.com/docker/docker/pkg/mflag" flag "github.com/docker/docker/pkg/mflag"
"github.com/docker/docker/pkg/parsers" "github.com/docker/docker/pkg/parsers"
"github.com/docker/docker/pkg/parsers/filters" "github.com/docker/docker/pkg/parsers/filters"

View file

@ -11,9 +11,9 @@ import (
"runtime" "runtime"
"strings" "strings"
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/api" "github.com/docker/docker/api"
"github.com/docker/docker/dockerversion" "github.com/docker/docker/dockerversion"
"github.com/docker/docker/pkg/log"
"github.com/docker/docker/pkg/promise" "github.com/docker/docker/pkg/promise"
"github.com/docker/docker/pkg/stdcopy" "github.com/docker/docker/pkg/stdcopy"
"github.com/docker/docker/pkg/term" "github.com/docker/docker/pkg/term"

View file

@ -16,10 +16,10 @@ import (
"strings" "strings"
"syscall" "syscall"
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/api" "github.com/docker/docker/api"
"github.com/docker/docker/dockerversion" "github.com/docker/docker/dockerversion"
"github.com/docker/docker/engine" "github.com/docker/docker/engine"
"github.com/docker/docker/pkg/log"
"github.com/docker/docker/pkg/stdcopy" "github.com/docker/docker/pkg/stdcopy"
"github.com/docker/docker/pkg/term" "github.com/docker/docker/pkg/term"
"github.com/docker/docker/registry" "github.com/docker/docker/registry"

View file

@ -5,8 +5,8 @@ import (
"mime" "mime"
"strings" "strings"
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/engine" "github.com/docker/docker/engine"
"github.com/docker/docker/pkg/log"
"github.com/docker/docker/pkg/parsers" "github.com/docker/docker/pkg/parsers"
"github.com/docker/docker/pkg/version" "github.com/docker/docker/pkg/version"
) )

View file

@ -23,10 +23,10 @@ import (
"github.com/docker/libcontainer/user" "github.com/docker/libcontainer/user"
"github.com/gorilla/mux" "github.com/gorilla/mux"
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/api" "github.com/docker/docker/api"
"github.com/docker/docker/engine" "github.com/docker/docker/engine"
"github.com/docker/docker/pkg/listenbuffer" "github.com/docker/docker/pkg/listenbuffer"
"github.com/docker/docker/pkg/log"
"github.com/docker/docker/pkg/parsers" "github.com/docker/docker/pkg/parsers"
"github.com/docker/docker/pkg/stdcopy" "github.com/docker/docker/pkg/stdcopy"
"github.com/docker/docker/pkg/systemd" "github.com/docker/docker/pkg/systemd"

View file

@ -14,8 +14,8 @@ import (
"regexp" "regexp"
"strings" "strings"
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/nat" "github.com/docker/docker/nat"
"github.com/docker/docker/pkg/log"
flag "github.com/docker/docker/pkg/mflag" flag "github.com/docker/docker/pkg/mflag"
"github.com/docker/docker/runconfig" "github.com/docker/docker/runconfig"
) )

View file

@ -27,10 +27,10 @@ import (
"path" "path"
"strings" "strings"
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/builder/parser" "github.com/docker/docker/builder/parser"
"github.com/docker/docker/daemon" "github.com/docker/docker/daemon"
"github.com/docker/docker/engine" "github.com/docker/docker/engine"
"github.com/docker/docker/pkg/log"
"github.com/docker/docker/pkg/tarsum" "github.com/docker/docker/pkg/tarsum"
"github.com/docker/docker/registry" "github.com/docker/docker/registry"
"github.com/docker/docker/runconfig" "github.com/docker/docker/runconfig"

View file

@ -18,11 +18,11 @@ import (
"syscall" "syscall"
"time" "time"
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/builder/parser" "github.com/docker/docker/builder/parser"
"github.com/docker/docker/daemon" "github.com/docker/docker/daemon"
imagepkg "github.com/docker/docker/image" imagepkg "github.com/docker/docker/image"
"github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/log"
"github.com/docker/docker/pkg/parsers" "github.com/docker/docker/pkg/parsers"
"github.com/docker/docker/pkg/symlink" "github.com/docker/docker/pkg/symlink"
"github.com/docker/docker/pkg/system" "github.com/docker/docker/pkg/system"

View file

@ -9,7 +9,7 @@ import (
"github.com/docker/docker/engine" "github.com/docker/docker/engine"
"github.com/docker/docker/pkg/ioutils" "github.com/docker/docker/pkg/ioutils"
"github.com/docker/docker/pkg/jsonlog" "github.com/docker/docker/pkg/jsonlog"
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
"github.com/docker/docker/pkg/promise" "github.com/docker/docker/pkg/promise"
"github.com/docker/docker/utils" "github.com/docker/docker/utils"
) )

View file

@ -25,7 +25,7 @@ import (
"github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/broadcastwriter" "github.com/docker/docker/pkg/broadcastwriter"
"github.com/docker/docker/pkg/ioutils" "github.com/docker/docker/pkg/ioutils"
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
"github.com/docker/docker/pkg/networkfs/etchosts" "github.com/docker/docker/pkg/networkfs/etchosts"
"github.com/docker/docker/pkg/networkfs/resolvconf" "github.com/docker/docker/pkg/networkfs/resolvconf"
"github.com/docker/docker/pkg/promise" "github.com/docker/docker/pkg/promise"

View file

@ -14,6 +14,7 @@ import (
"github.com/docker/libcontainer/label" "github.com/docker/libcontainer/label"
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/daemon/execdriver" "github.com/docker/docker/daemon/execdriver"
"github.com/docker/docker/daemon/execdriver/execdrivers" "github.com/docker/docker/daemon/execdriver/execdrivers"
"github.com/docker/docker/daemon/execdriver/lxc" "github.com/docker/docker/daemon/execdriver/lxc"
@ -29,7 +30,6 @@ import (
"github.com/docker/docker/pkg/broadcastwriter" "github.com/docker/docker/pkg/broadcastwriter"
"github.com/docker/docker/pkg/graphdb" "github.com/docker/docker/pkg/graphdb"
"github.com/docker/docker/pkg/ioutils" "github.com/docker/docker/pkg/ioutils"
"github.com/docker/docker/pkg/log"
"github.com/docker/docker/pkg/namesgenerator" "github.com/docker/docker/pkg/namesgenerator"
"github.com/docker/docker/pkg/parsers" "github.com/docker/docker/pkg/parsers"
"github.com/docker/docker/pkg/parsers/kernel" "github.com/docker/docker/pkg/parsers/kernel"
@ -304,7 +304,7 @@ func (daemon *Daemon) restore() error {
) )
if !debug { if !debug {
log.Infof("Loading containers: ") log.Infof("Loading containers: start.")
} }
dir, err := ioutil.ReadDir(daemon.repository) dir, err := ioutil.ReadDir(daemon.repository)
if err != nil { if err != nil {
@ -392,7 +392,8 @@ func (daemon *Daemon) restore() error {
} }
if !debug { if !debug {
log.Infof(": done.") fmt.Println()
log.Infof("Loading containers: done.")
} }
return nil return nil

View file

@ -6,7 +6,7 @@ import (
"github.com/docker/docker/daemon/graphdriver" "github.com/docker/docker/daemon/graphdriver"
"github.com/docker/docker/daemon/graphdriver/aufs" "github.com/docker/docker/daemon/graphdriver/aufs"
"github.com/docker/docker/graph" "github.com/docker/docker/graph"
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
) )
// Given the graphdriver ad, if it is aufs, then migrate it. // Given the graphdriver ad, if it is aufs, then migrate it.

View file

@ -6,7 +6,7 @@ import (
"path" "path"
"github.com/docker/docker/engine" "github.com/docker/docker/engine"
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
) )
func (daemon *Daemon) ContainerRm(job *engine.Job) engine.Status { func (daemon *Daemon) ContainerRm(job *engine.Job) engine.Status {

View file

@ -14,7 +14,7 @@ import (
"github.com/docker/docker/engine" "github.com/docker/docker/engine"
"github.com/docker/docker/pkg/broadcastwriter" "github.com/docker/docker/pkg/broadcastwriter"
"github.com/docker/docker/pkg/ioutils" "github.com/docker/docker/pkg/ioutils"
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
"github.com/docker/docker/pkg/promise" "github.com/docker/docker/pkg/promise"
"github.com/docker/docker/runconfig" "github.com/docker/docker/runconfig"
"github.com/docker/docker/utils" "github.com/docker/docker/utils"

View file

@ -18,7 +18,7 @@ import (
"github.com/kr/pty" "github.com/kr/pty"
"github.com/docker/docker/daemon/execdriver" "github.com/docker/docker/daemon/execdriver"
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
"github.com/docker/docker/pkg/term" "github.com/docker/docker/pkg/term"
"github.com/docker/docker/utils" "github.com/docker/docker/utils"
"github.com/docker/libcontainer/cgroups" "github.com/docker/libcontainer/cgroups"

View file

@ -32,7 +32,7 @@ import (
"github.com/docker/docker/daemon/graphdriver" "github.com/docker/docker/daemon/graphdriver"
"github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
mountpk "github.com/docker/docker/pkg/mount" mountpk "github.com/docker/docker/pkg/mount"
"github.com/docker/docker/utils" "github.com/docker/docker/utils"
"github.com/docker/libcontainer/label" "github.com/docker/libcontainer/label"

View file

@ -4,7 +4,7 @@ import (
"os/exec" "os/exec"
"syscall" "syscall"
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
) )
func Unmount(target string) error { func Unmount(target string) error {

View file

@ -7,7 +7,7 @@ import (
"os" "os"
"syscall" "syscall"
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
) )
func stringToLoopName(src string) [LoNameSize]uint8 { func stringToLoopName(src string) [LoNameSize]uint8 {

View file

@ -19,7 +19,7 @@ import (
"time" "time"
"github.com/docker/docker/daemon/graphdriver" "github.com/docker/docker/daemon/graphdriver"
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
"github.com/docker/docker/pkg/parsers" "github.com/docker/docker/pkg/parsers"
"github.com/docker/docker/pkg/units" "github.com/docker/docker/pkg/units"
"github.com/docker/libcontainer/label" "github.com/docker/libcontainer/label"

View file

@ -9,7 +9,7 @@ import (
"runtime" "runtime"
"syscall" "syscall"
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
) )
type DevmapperLogger interface { type DevmapperLogger interface {

View file

@ -9,7 +9,7 @@ import (
"path" "path"
"github.com/docker/docker/daemon/graphdriver" "github.com/docker/docker/daemon/graphdriver"
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
"github.com/docker/docker/pkg/mount" "github.com/docker/docker/pkg/mount"
"github.com/docker/docker/pkg/units" "github.com/docker/docker/pkg/units"
) )

View file

@ -6,7 +6,7 @@ import (
"github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/ioutils" "github.com/docker/docker/pkg/ioutils"
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
"github.com/docker/docker/utils" "github.com/docker/docker/utils"
) )

View file

@ -6,7 +6,7 @@ import (
"github.com/docker/docker/dockerversion" "github.com/docker/docker/dockerversion"
"github.com/docker/docker/engine" "github.com/docker/docker/engine"
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
"github.com/docker/docker/pkg/parsers/kernel" "github.com/docker/docker/pkg/parsers/kernel"
"github.com/docker/docker/pkg/parsers/operatingsystem" "github.com/docker/docker/pkg/parsers/operatingsystem"
"github.com/docker/docker/registry" "github.com/docker/docker/registry"

View file

@ -10,7 +10,7 @@ import (
"github.com/docker/docker/engine" "github.com/docker/docker/engine"
"github.com/docker/docker/pkg/jsonlog" "github.com/docker/docker/pkg/jsonlog"
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
"github.com/docker/docker/pkg/tailfile" "github.com/docker/docker/pkg/tailfile"
"github.com/docker/docker/pkg/timeutils" "github.com/docker/docker/pkg/timeutils"
) )

View file

@ -7,7 +7,7 @@ import (
"time" "time"
"github.com/docker/docker/daemon/execdriver" "github.com/docker/docker/daemon/execdriver"
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
"github.com/docker/docker/runconfig" "github.com/docker/docker/runconfig"
) )

View file

@ -14,7 +14,7 @@ import (
"github.com/docker/docker/daemon/networkdriver/portmapper" "github.com/docker/docker/daemon/networkdriver/portmapper"
"github.com/docker/docker/engine" "github.com/docker/docker/engine"
"github.com/docker/docker/pkg/iptables" "github.com/docker/docker/pkg/iptables"
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
"github.com/docker/docker/pkg/networkfs/resolvconf" "github.com/docker/docker/pkg/networkfs/resolvconf"
"github.com/docker/docker/pkg/parsers/kernel" "github.com/docker/docker/pkg/parsers/kernel"
"github.com/docker/libcontainer/netlink" "github.com/docker/libcontainer/netlink"

View file

@ -8,7 +8,7 @@ import (
"github.com/docker/docker/daemon/networkdriver/portallocator" "github.com/docker/docker/daemon/networkdriver/portallocator"
"github.com/docker/docker/pkg/iptables" "github.com/docker/docker/pkg/iptables"
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
) )
type mapping struct { type mapping struct {

View file

@ -12,7 +12,7 @@ import (
"github.com/docker/docker/daemon/execdriver" "github.com/docker/docker/daemon/execdriver"
"github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
"github.com/docker/docker/pkg/symlink" "github.com/docker/docker/pkg/symlink"
"github.com/docker/docker/volumes" "github.com/docker/docker/volumes"
) )

View file

@ -3,6 +3,7 @@
package main package main
import ( import (
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/builder" "github.com/docker/docker/builder"
"github.com/docker/docker/builtins" "github.com/docker/docker/builtins"
"github.com/docker/docker/daemon" "github.com/docker/docker/daemon"
@ -10,7 +11,6 @@ import (
_ "github.com/docker/docker/daemon/execdriver/native" _ "github.com/docker/docker/daemon/execdriver/native"
"github.com/docker/docker/dockerversion" "github.com/docker/docker/dockerversion"
"github.com/docker/docker/engine" "github.com/docker/docker/engine"
"github.com/docker/docker/pkg/log"
flag "github.com/docker/docker/pkg/mflag" flag "github.com/docker/docker/pkg/mflag"
"github.com/docker/docker/pkg/signal" "github.com/docker/docker/pkg/signal"
) )

View file

@ -28,6 +28,7 @@ func main() {
if reexec.Init() { if reexec.Init() {
return return
} }
flag.Parse() flag.Parse()
// FIXME: validate daemon flags here // FIXME: validate daemon flags here
@ -39,6 +40,8 @@ func main() {
os.Setenv("DEBUG", "1") os.Setenv("DEBUG", "1")
} }
initLogging(*flDebug)
if len(flHosts) == 0 { if len(flHosts) == 0 {
defaultHost := os.Getenv("DOCKER_HOST") defaultHost := os.Getenv("DOCKER_HOST")
if defaultHost == "" || *flDaemon { if defaultHost == "" || *flDaemon {

16
docker/log.go Normal file
View file

@ -0,0 +1,16 @@
package main
import (
"os"
log "github.com/Sirupsen/logrus"
)
func initLogging(debug bool) {
log.SetOutput(os.Stderr)
if debug {
log.SetLevel(log.DebugLevel)
} else {
log.SetLevel(log.InfoLevel)
}
}

View file

@ -9,7 +9,7 @@ import (
"github.com/docker/docker/engine" "github.com/docker/docker/engine"
"github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
"github.com/docker/docker/pkg/parsers" "github.com/docker/docker/pkg/parsers"
) )

View file

@ -16,7 +16,7 @@ import (
"github.com/docker/docker/dockerversion" "github.com/docker/docker/dockerversion"
"github.com/docker/docker/image" "github.com/docker/docker/image"
"github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
"github.com/docker/docker/pkg/truncindex" "github.com/docker/docker/pkg/truncindex"
"github.com/docker/docker/runconfig" "github.com/docker/docker/runconfig"
"github.com/docker/docker/utils" "github.com/docker/docker/utils"

View file

@ -10,7 +10,7 @@ import (
"github.com/docker/docker/engine" "github.com/docker/docker/engine"
"github.com/docker/docker/image" "github.com/docker/docker/image"
"github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
) )
// Loads a set of images into the repository. This is the complementary of ImageExport. // Loads a set of images into the repository. This is the complementary of ImageExport.

View file

@ -14,7 +14,7 @@ import (
"github.com/docker/docker/engine" "github.com/docker/docker/engine"
"github.com/docker/docker/image" "github.com/docker/docker/image"
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
"github.com/docker/docker/registry" "github.com/docker/docker/registry"
"github.com/docker/docker/utils" "github.com/docker/docker/utils"
"github.com/docker/libtrust" "github.com/docker/libtrust"

View file

@ -9,7 +9,7 @@ import (
"github.com/docker/docker/engine" "github.com/docker/docker/engine"
"github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
"github.com/docker/docker/registry" "github.com/docker/docker/registry"
"github.com/docker/docker/utils" "github.com/docker/docker/utils"
) )

View file

@ -6,7 +6,7 @@ import (
"github.com/docker/docker/engine" "github.com/docker/docker/engine"
"github.com/docker/docker/image" "github.com/docker/docker/image"
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
) )
func (s *TagStore) Install(eng *engine.Engine) error { func (s *TagStore) Install(eng *engine.Engine) error {

View file

@ -10,7 +10,7 @@ import (
"time" "time"
"github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
"github.com/docker/docker/runconfig" "github.com/docker/docker/runconfig"
"github.com/docker/docker/utils" "github.com/docker/docker/utils"
) )

View file

@ -11,7 +11,7 @@ import (
"github.com/docker/docker/api/client" "github.com/docker/docker/api/client"
"github.com/docker/docker/daemon" "github.com/docker/docker/daemon"
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
"github.com/docker/docker/pkg/term" "github.com/docker/docker/pkg/term"
"github.com/docker/docker/utils" "github.com/docker/docker/utils"
"github.com/docker/libtrust" "github.com/docker/libtrust"

View file

@ -21,7 +21,7 @@ import (
"github.com/docker/docker/image" "github.com/docker/docker/image"
"github.com/docker/docker/nat" "github.com/docker/docker/nat"
"github.com/docker/docker/pkg/ioutils" "github.com/docker/docker/pkg/ioutils"
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
"github.com/docker/docker/reexec" "github.com/docker/docker/reexec"
"github.com/docker/docker/runconfig" "github.com/docker/docker/runconfig"
"github.com/docker/docker/utils" "github.com/docker/docker/utils"

View file

@ -18,20 +18,23 @@ import (
"github.com/docker/docker/builtins" "github.com/docker/docker/builtins"
"github.com/docker/docker/daemon" "github.com/docker/docker/daemon"
"github.com/docker/docker/engine" "github.com/docker/docker/engine"
"github.com/docker/docker/pkg/log"
flag "github.com/docker/docker/pkg/mflag" flag "github.com/docker/docker/pkg/mflag"
"github.com/docker/docker/pkg/sysinfo" "github.com/docker/docker/pkg/sysinfo"
"github.com/docker/docker/runconfig" "github.com/docker/docker/runconfig"
"github.com/docker/docker/utils" "github.com/docker/docker/utils"
) )
type Fataler interface {
Fatal(...interface{})
}
// This file contains utility functions for docker's unit test suite. // This file contains utility functions for docker's unit test suite.
// It has to be named XXX_test.go, apparently, in other to access private functions // It has to be named XXX_test.go, apparently, in other to access private functions
// from other XXX_test.go functions. // from other XXX_test.go functions.
// Create a temporary daemon suitable for unit testing. // Create a temporary daemon suitable for unit testing.
// Call t.Fatal() at the first error. // Call t.Fatal() at the first error.
func mkDaemon(f log.Fataler) *daemon.Daemon { func mkDaemon(f Fataler) *daemon.Daemon {
eng := newTestEngine(f, false, "") eng := newTestEngine(f, false, "")
return mkDaemonFromEngine(eng, f) return mkDaemonFromEngine(eng, f)
// FIXME: // FIXME:
@ -40,7 +43,7 @@ func mkDaemon(f log.Fataler) *daemon.Daemon {
// [...] // [...]
} }
func createNamedTestContainer(eng *engine.Engine, config *runconfig.Config, f log.Fataler, name string) (shortId string) { func createNamedTestContainer(eng *engine.Engine, config *runconfig.Config, f Fataler, name string) (shortId string) {
job := eng.Job("create", name) job := eng.Job("create", name)
if err := job.ImportEnv(config); err != nil { if err := job.ImportEnv(config); err != nil {
f.Fatal(err) f.Fatal(err)
@ -53,23 +56,23 @@ func createNamedTestContainer(eng *engine.Engine, config *runconfig.Config, f lo
return engine.Tail(outputBuffer, 1) return engine.Tail(outputBuffer, 1)
} }
func createTestContainer(eng *engine.Engine, config *runconfig.Config, f log.Fataler) (shortId string) { func createTestContainer(eng *engine.Engine, config *runconfig.Config, f Fataler) (shortId string) {
return createNamedTestContainer(eng, config, f, "") return createNamedTestContainer(eng, config, f, "")
} }
func startContainer(eng *engine.Engine, id string, t log.Fataler) { func startContainer(eng *engine.Engine, id string, t Fataler) {
job := eng.Job("start", id) job := eng.Job("start", id)
if err := job.Run(); err != nil { if err := job.Run(); err != nil {
t.Fatal(err) t.Fatal(err)
} }
} }
func containerRun(eng *engine.Engine, id string, t log.Fataler) { func containerRun(eng *engine.Engine, id string, t Fataler) {
startContainer(eng, id, t) startContainer(eng, id, t)
containerWait(eng, id, t) containerWait(eng, id, t)
} }
func containerFileExists(eng *engine.Engine, id, dir string, t log.Fataler) bool { func containerFileExists(eng *engine.Engine, id, dir string, t Fataler) bool {
c := getContainer(eng, id, t) c := getContainer(eng, id, t)
if err := c.Mount(); err != nil { if err := c.Mount(); err != nil {
t.Fatal(err) t.Fatal(err)
@ -84,7 +87,7 @@ func containerFileExists(eng *engine.Engine, id, dir string, t log.Fataler) bool
return true return true
} }
func containerAttach(eng *engine.Engine, id string, t log.Fataler) (io.WriteCloser, io.ReadCloser) { func containerAttach(eng *engine.Engine, id string, t Fataler) (io.WriteCloser, io.ReadCloser) {
c := getContainer(eng, id, t) c := getContainer(eng, id, t)
i, err := c.StdinPipe() i, err := c.StdinPipe()
if err != nil { if err != nil {
@ -97,31 +100,31 @@ func containerAttach(eng *engine.Engine, id string, t log.Fataler) (io.WriteClos
return i, o return i, o
} }
func containerWait(eng *engine.Engine, id string, t log.Fataler) int { func containerWait(eng *engine.Engine, id string, t Fataler) int {
ex, _ := getContainer(eng, id, t).WaitStop(-1 * time.Second) ex, _ := getContainer(eng, id, t).WaitStop(-1 * time.Second)
return ex return ex
} }
func containerWaitTimeout(eng *engine.Engine, id string, t log.Fataler) error { func containerWaitTimeout(eng *engine.Engine, id string, t Fataler) error {
_, err := getContainer(eng, id, t).WaitStop(500 * time.Millisecond) _, err := getContainer(eng, id, t).WaitStop(500 * time.Millisecond)
return err return err
} }
func containerKill(eng *engine.Engine, id string, t log.Fataler) { func containerKill(eng *engine.Engine, id string, t Fataler) {
if err := eng.Job("kill", id).Run(); err != nil { if err := eng.Job("kill", id).Run(); err != nil {
t.Fatal(err) t.Fatal(err)
} }
} }
func containerRunning(eng *engine.Engine, id string, t log.Fataler) bool { func containerRunning(eng *engine.Engine, id string, t Fataler) bool {
return getContainer(eng, id, t).IsRunning() return getContainer(eng, id, t).IsRunning()
} }
func containerAssertExists(eng *engine.Engine, id string, t log.Fataler) { func containerAssertExists(eng *engine.Engine, id string, t Fataler) {
getContainer(eng, id, t) getContainer(eng, id, t)
} }
func containerAssertNotExists(eng *engine.Engine, id string, t log.Fataler) { func containerAssertNotExists(eng *engine.Engine, id string, t Fataler) {
daemon := mkDaemonFromEngine(eng, t) daemon := mkDaemonFromEngine(eng, t)
if c := daemon.Get(id); c != nil { if c := daemon.Get(id); c != nil {
t.Fatal(fmt.Errorf("Container %s should not exist", id)) t.Fatal(fmt.Errorf("Container %s should not exist", id))
@ -130,7 +133,7 @@ func containerAssertNotExists(eng *engine.Engine, id string, t log.Fataler) {
// assertHttpNotError expect the given response to not have an error. // assertHttpNotError expect the given response to not have an error.
// Otherwise the it causes the test to fail. // Otherwise the it causes the test to fail.
func assertHttpNotError(r *httptest.ResponseRecorder, t log.Fataler) { func assertHttpNotError(r *httptest.ResponseRecorder, t Fataler) {
// Non-error http status are [200, 400) // Non-error http status are [200, 400)
if r.Code < http.StatusOK || r.Code >= http.StatusBadRequest { if r.Code < http.StatusOK || r.Code >= http.StatusBadRequest {
t.Fatal(fmt.Errorf("Unexpected http error: %v", r.Code)) t.Fatal(fmt.Errorf("Unexpected http error: %v", r.Code))
@ -139,14 +142,14 @@ func assertHttpNotError(r *httptest.ResponseRecorder, t log.Fataler) {
// assertHttpError expect the given response to have an error. // assertHttpError expect the given response to have an error.
// Otherwise the it causes the test to fail. // Otherwise the it causes the test to fail.
func assertHttpError(r *httptest.ResponseRecorder, t log.Fataler) { func assertHttpError(r *httptest.ResponseRecorder, t Fataler) {
// Non-error http status are [200, 400) // Non-error http status are [200, 400)
if !(r.Code < http.StatusOK || r.Code >= http.StatusBadRequest) { if !(r.Code < http.StatusOK || r.Code >= http.StatusBadRequest) {
t.Fatal(fmt.Errorf("Unexpected http success code: %v", r.Code)) t.Fatal(fmt.Errorf("Unexpected http success code: %v", r.Code))
} }
} }
func getContainer(eng *engine.Engine, id string, t log.Fataler) *daemon.Container { func getContainer(eng *engine.Engine, id string, t Fataler) *daemon.Container {
daemon := mkDaemonFromEngine(eng, t) daemon := mkDaemonFromEngine(eng, t)
c := daemon.Get(id) c := daemon.Get(id)
if c == nil { if c == nil {
@ -155,7 +158,7 @@ func getContainer(eng *engine.Engine, id string, t log.Fataler) *daemon.Containe
return c return c
} }
func mkDaemonFromEngine(eng *engine.Engine, t log.Fataler) *daemon.Daemon { func mkDaemonFromEngine(eng *engine.Engine, t Fataler) *daemon.Daemon {
iDaemon := eng.Hack_GetGlobalVar("httpapi.daemon") iDaemon := eng.Hack_GetGlobalVar("httpapi.daemon")
if iDaemon == nil { if iDaemon == nil {
panic("Legacy daemon field not set in engine") panic("Legacy daemon field not set in engine")
@ -167,7 +170,7 @@ func mkDaemonFromEngine(eng *engine.Engine, t log.Fataler) *daemon.Daemon {
return daemon return daemon
} }
func newTestEngine(t log.Fataler, autorestart bool, root string) *engine.Engine { func newTestEngine(t Fataler, autorestart bool, root string) *engine.Engine {
if root == "" { if root == "" {
if dir, err := newTestDirectory(unitTestStoreBase); err != nil { if dir, err := newTestDirectory(unitTestStoreBase); err != nil {
t.Fatal(err) t.Fatal(err)
@ -200,7 +203,7 @@ func newTestEngine(t log.Fataler, autorestart bool, root string) *engine.Engine
return eng return eng
} }
func NewTestEngine(t log.Fataler) *engine.Engine { func NewTestEngine(t Fataler) *engine.Engine {
return newTestEngine(t, false, "") return newTestEngine(t, false, "")
} }

View file

@ -19,7 +19,7 @@ import (
"github.com/docker/docker/vendor/src/code.google.com/p/go/src/pkg/archive/tar" "github.com/docker/docker/vendor/src/code.google.com/p/go/src/pkg/archive/tar"
"github.com/docker/docker/pkg/fileutils" "github.com/docker/docker/pkg/fileutils"
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
"github.com/docker/docker/pkg/pools" "github.com/docker/docker/pkg/pools"
"github.com/docker/docker/pkg/promise" "github.com/docker/docker/pkg/promise"
"github.com/docker/docker/pkg/system" "github.com/docker/docker/pkg/system"

View file

@ -12,7 +12,7 @@ import (
"github.com/docker/docker/vendor/src/code.google.com/p/go/src/pkg/archive/tar" "github.com/docker/docker/vendor/src/code.google.com/p/go/src/pkg/archive/tar"
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
"github.com/docker/docker/pkg/pools" "github.com/docker/docker/pkg/pools"
"github.com/docker/docker/pkg/system" "github.com/docker/docker/pkg/system"
) )

View file

@ -7,7 +7,7 @@ import (
"time" "time"
"github.com/docker/docker/pkg/jsonlog" "github.com/docker/docker/pkg/jsonlog"
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
) )
// BroadcastWriter accumulate multiple io.WriteCloser by stream. // BroadcastWriter accumulate multiple io.WriteCloser by stream.

View file

@ -1,7 +1,7 @@
package fileutils package fileutils
import ( import (
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
"path/filepath" "path/filepath"
) )

View file

@ -6,7 +6,7 @@ import (
"net/http" "net/http"
"time" "time"
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
) )
type resumableRequestReader struct { type resumableRequestReader struct {

View file

@ -9,7 +9,7 @@ import (
"strconv" "strconv"
"strings" "strings"
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
) )
type Action string type Action string

View file

@ -8,9 +8,18 @@ import (
"strings" "strings"
"time" "time"
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/pkg/timeutils" "github.com/docker/docker/pkg/timeutils"
) )
func init() {
log.SetOutput(os.Stderr)
log.SetLevel(log.InfoLevel)
if os.Getenv("DEBUG") != "" {
log.SetLevel(log.DebugLevel)
}
}
type priority int type priority int
const ( const (

View file

@ -6,7 +6,7 @@ import (
"sync/atomic" "sync/atomic"
"syscall" "syscall"
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
) )
// Trap sets up a simplified signal "trap", appropriate for common // Trap sets up a simplified signal "trap", appropriate for common

View file

@ -5,7 +5,7 @@ import (
"errors" "errors"
"io" "io"
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
) )
const ( const (

View file

@ -13,7 +13,7 @@ import (
"github.com/docker/docker/vendor/src/code.google.com/p/go/src/pkg/archive/tar" "github.com/docker/docker/vendor/src/code.google.com/p/go/src/pkg/archive/tar"
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
) )
const ( const (

View file

@ -9,7 +9,7 @@ import (
"net/url" "net/url"
"strings" "strings"
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
) )
// scans string for api version in the URL path. returns the trimmed hostname, if version found, string and API version. // scans string for api version in the URL path. returns the trimmed hostname, if version found, string and API version.

View file

@ -15,7 +15,7 @@ import (
"github.com/gorilla/mux" "github.com/gorilla/mux"
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
) )
var ( var (

View file

@ -18,7 +18,7 @@ import (
"time" "time"
"github.com/docker/docker/pkg/httputils" "github.com/docker/docker/pkg/httputils"
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
"github.com/docker/docker/pkg/tarsum" "github.com/docker/docker/pkg/tarsum"
"github.com/docker/docker/utils" "github.com/docker/docker/utils"
) )

View file

@ -8,7 +8,7 @@ import (
"net/url" "net/url"
"strconv" "strconv"
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
"github.com/docker/docker/utils" "github.com/docker/docker/utils"
"github.com/gorilla/mux" "github.com/gorilla/mux"
) )

View file

@ -4,7 +4,7 @@ import (
"strings" "strings"
"github.com/docker/docker/nat" "github.com/docker/docker/nat"
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
) )
func Merge(userConf, imageConf *Config) error { func Merge(userConf, imageConf *Config) error {

View file

@ -5,7 +5,7 @@ import (
"time" "time"
"github.com/docker/docker/engine" "github.com/docker/docker/engine"
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
"github.com/docker/libtrust" "github.com/docker/libtrust"
) )

View file

@ -12,7 +12,7 @@ import (
"sync" "sync"
"time" "time"
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
"github.com/docker/libtrust/trustgraph" "github.com/docker/libtrust/trustgraph"
) )

View file

@ -5,7 +5,7 @@ import (
"net/http" "net/http"
"strings" "strings"
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
) )
// VersionInfo is used to model entities which has a version. // VersionInfo is used to model entities which has a version.

View file

@ -23,7 +23,7 @@ import (
"github.com/docker/docker/dockerversion" "github.com/docker/docker/dockerversion"
"github.com/docker/docker/pkg/fileutils" "github.com/docker/docker/pkg/fileutils"
"github.com/docker/docker/pkg/ioutils" "github.com/docker/docker/pkg/ioutils"
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
) )
type KeyValuePair struct { type KeyValuePair struct {

View file

@ -8,7 +8,7 @@ import (
"sync" "sync"
"github.com/docker/docker/daemon/graphdriver" "github.com/docker/docker/daemon/graphdriver"
"github.com/docker/docker/pkg/log" log "github.com/Sirupsen/logrus"
"github.com/docker/docker/utils" "github.com/docker/docker/utils"
) )