Skip to content

Commit

Permalink
Use logrus everywhere for logging
Browse files Browse the repository at this point in the history
Fixed moby#8761

Signed-off-by: Alexandr Morozov <[email protected]>
  • Loading branch information
LK4D4 committed Oct 24, 2014
1 parent 6229a36 commit 7c62cee
Show file tree
Hide file tree
Showing 61 changed files with 111 additions and 79 deletions.
2 changes: 1 addition & 1 deletion api/client/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ import (
"text/template"
"time"

log "github.com/Sirupsen/logrus"
"github.com/docker/docker/api"
"github.com/docker/docker/dockerversion"
"github.com/docker/docker/engine"
"github.com/docker/docker/graph"
"github.com/docker/docker/nat"
"github.com/docker/docker/opts"
"github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/log"
flag "github.com/docker/docker/pkg/mflag"
"github.com/docker/docker/pkg/parsers"
"github.com/docker/docker/pkg/parsers/filters"
Expand Down
2 changes: 1 addition & 1 deletion api/client/hijack.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import (
"runtime"
"strings"

log "github.com/Sirupsen/logrus"
"github.com/docker/docker/api"
"github.com/docker/docker/dockerversion"
"github.com/docker/docker/pkg/log"
"github.com/docker/docker/pkg/promise"
"github.com/docker/docker/pkg/stdcopy"
"github.com/docker/docker/pkg/term"
Expand Down
2 changes: 1 addition & 1 deletion api/client/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ import (
"strings"
"syscall"

log "github.com/Sirupsen/logrus"
"github.com/docker/docker/api"
"github.com/docker/docker/dockerversion"
"github.com/docker/docker/engine"
"github.com/docker/docker/pkg/log"
"github.com/docker/docker/pkg/stdcopy"
"github.com/docker/docker/pkg/term"
"github.com/docker/docker/registry"
Expand Down
2 changes: 1 addition & 1 deletion api/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"mime"
"strings"

log "github.com/Sirupsen/logrus"
"github.com/docker/docker/engine"
"github.com/docker/docker/pkg/log"
"github.com/docker/docker/pkg/parsers"
"github.com/docker/docker/pkg/version"
)
Expand Down
2 changes: 1 addition & 1 deletion api/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ import (
"github.com/docker/libcontainer/user"
"github.com/gorilla/mux"

log "github.com/Sirupsen/logrus"
"github.com/docker/docker/api"
"github.com/docker/docker/engine"
"github.com/docker/docker/pkg/listenbuffer"
"github.com/docker/docker/pkg/log"
"github.com/docker/docker/pkg/parsers"
"github.com/docker/docker/pkg/stdcopy"
"github.com/docker/docker/pkg/systemd"
Expand Down
2 changes: 1 addition & 1 deletion builder/dispatchers.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (
"regexp"
"strings"

log "github.com/Sirupsen/logrus"
"github.com/docker/docker/nat"
"github.com/docker/docker/pkg/log"
flag "github.com/docker/docker/pkg/mflag"
"github.com/docker/docker/runconfig"
)
Expand Down
2 changes: 1 addition & 1 deletion builder/evaluator.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ import (
"path"
"strings"

log "github.com/Sirupsen/logrus"
"github.com/docker/docker/builder/parser"
"github.com/docker/docker/daemon"
"github.com/docker/docker/engine"
"github.com/docker/docker/pkg/log"
"github.com/docker/docker/pkg/tarsum"
"github.com/docker/docker/registry"
"github.com/docker/docker/runconfig"
Expand Down
2 changes: 1 addition & 1 deletion builder/internals.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ import (
"syscall"
"time"

log "github.com/Sirupsen/logrus"
"github.com/docker/docker/builder/parser"
"github.com/docker/docker/daemon"
imagepkg "github.com/docker/docker/image"
"github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/log"
"github.com/docker/docker/pkg/parsers"
"github.com/docker/docker/pkg/symlink"
"github.com/docker/docker/pkg/system"
Expand Down
2 changes: 1 addition & 1 deletion daemon/attach.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/docker/docker/engine"
"github.com/docker/docker/pkg/ioutils"
"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/utils"
)
Expand Down
2 changes: 1 addition & 1 deletion daemon/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/broadcastwriter"
"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/resolvconf"
"github.com/docker/docker/pkg/promise"
Expand Down
7 changes: 4 additions & 3 deletions daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (

"github.com/docker/libcontainer/label"

log "github.com/Sirupsen/logrus"
"github.com/docker/docker/daemon/execdriver"
"github.com/docker/docker/daemon/execdriver/execdrivers"
"github.com/docker/docker/daemon/execdriver/lxc"
Expand All @@ -29,7 +30,6 @@ import (
"github.com/docker/docker/pkg/broadcastwriter"
"github.com/docker/docker/pkg/graphdb"
"github.com/docker/docker/pkg/ioutils"
"github.com/docker/docker/pkg/log"
"github.com/docker/docker/pkg/namesgenerator"
"github.com/docker/docker/pkg/parsers"
"github.com/docker/docker/pkg/parsers/kernel"
Expand Down Expand Up @@ -304,7 +304,7 @@ func (daemon *Daemon) restore() error {
)

if !debug {
log.Infof("Loading containers: ")
log.Infof("Loading containers: start.")
}
dir, err := ioutil.ReadDir(daemon.repository)
if err != nil {
Expand Down Expand Up @@ -392,7 +392,8 @@ func (daemon *Daemon) restore() error {
}

if !debug {
log.Infof(": done.")
fmt.Println()
log.Infof("Loading containers: done.")
}

return nil
Expand Down
2 changes: 1 addition & 1 deletion daemon/daemon_aufs.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/docker/docker/daemon/graphdriver"
"github.com/docker/docker/daemon/graphdriver/aufs"
"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.
Expand Down
2 changes: 1 addition & 1 deletion daemon/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"path"

"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 {
Expand Down
2 changes: 1 addition & 1 deletion daemon/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/docker/docker/engine"
"github.com/docker/docker/pkg/broadcastwriter"
"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/runconfig"
"github.com/docker/docker/utils"
Expand Down
2 changes: 1 addition & 1 deletion daemon/execdriver/lxc/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"github.com/kr/pty"

"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/utils"
"github.com/docker/libcontainer/cgroups"
Expand Down
2 changes: 1 addition & 1 deletion daemon/graphdriver/aufs/aufs.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (

"github.com/docker/docker/daemon/graphdriver"
"github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/log"
log "github.com/Sirupsen/logrus"
mountpk "github.com/docker/docker/pkg/mount"
"github.com/docker/docker/utils"
"github.com/docker/libcontainer/label"
Expand Down
2 changes: 1 addition & 1 deletion daemon/graphdriver/aufs/mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"os/exec"
"syscall"

"github.com/docker/docker/pkg/log"
log "github.com/Sirupsen/logrus"
)

func Unmount(target string) error {
Expand Down
2 changes: 1 addition & 1 deletion daemon/graphdriver/devmapper/attach_loopback.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"os"
"syscall"

"github.com/docker/docker/pkg/log"
log "github.com/Sirupsen/logrus"
)

func stringToLoopName(src string) [LoNameSize]uint8 {
Expand Down
2 changes: 1 addition & 1 deletion daemon/graphdriver/devmapper/deviceset.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"time"

"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/units"
"github.com/docker/libcontainer/label"
Expand Down
2 changes: 1 addition & 1 deletion daemon/graphdriver/devmapper/devmapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"runtime"
"syscall"

"github.com/docker/docker/pkg/log"
log "github.com/Sirupsen/logrus"
)

type DevmapperLogger interface {
Expand Down
2 changes: 1 addition & 1 deletion daemon/graphdriver/devmapper/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"path"

"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/units"
)
Expand Down
2 changes: 1 addition & 1 deletion daemon/graphdriver/fsdiff.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/ioutils"
"github.com/docker/docker/pkg/log"
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/utils"
)

Expand Down
2 changes: 1 addition & 1 deletion daemon/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/docker/docker/dockerversion"
"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/operatingsystem"
"github.com/docker/docker/registry"
Expand Down
2 changes: 1 addition & 1 deletion daemon/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

"github.com/docker/docker/engine"
"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/timeutils"
)
Expand Down
2 changes: 1 addition & 1 deletion daemon/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"time"

"github.com/docker/docker/daemon/execdriver"
"github.com/docker/docker/pkg/log"
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/runconfig"
)

Expand Down
2 changes: 1 addition & 1 deletion daemon/networkdriver/bridge/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/docker/docker/daemon/networkdriver/portmapper"
"github.com/docker/docker/engine"
"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/parsers/kernel"
"github.com/docker/libcontainer/netlink"
Expand Down
2 changes: 1 addition & 1 deletion daemon/networkdriver/portmapper/mapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

"github.com/docker/docker/daemon/networkdriver/portallocator"
"github.com/docker/docker/pkg/iptables"
"github.com/docker/docker/pkg/log"
log "github.com/Sirupsen/logrus"
)

type mapping struct {
Expand Down
2 changes: 1 addition & 1 deletion daemon/volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

"github.com/docker/docker/daemon/execdriver"
"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/volumes"
)
Expand Down
2 changes: 1 addition & 1 deletion docker/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
package main

import (
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/builder"
"github.com/docker/docker/builtins"
"github.com/docker/docker/daemon"
_ "github.com/docker/docker/daemon/execdriver/lxc"
_ "github.com/docker/docker/daemon/execdriver/native"
"github.com/docker/docker/dockerversion"
"github.com/docker/docker/engine"
"github.com/docker/docker/pkg/log"
flag "github.com/docker/docker/pkg/mflag"
"github.com/docker/docker/pkg/signal"
)
Expand Down
3 changes: 3 additions & 0 deletions docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func main() {
if reexec.Init() {
return
}

flag.Parse()
// FIXME: validate daemon flags here

Expand All @@ -39,6 +40,8 @@ func main() {
os.Setenv("DEBUG", "1")
}

initLogging(*flDebug)

if len(flHosts) == 0 {
defaultHost := os.Getenv("DOCKER_HOST")
if defaultHost == "" || *flDaemon {
Expand Down
16 changes: 16 additions & 0 deletions docker/log.go
Original file line number Diff line number Diff line change
@@ -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)
}
}
2 changes: 1 addition & 1 deletion graph/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

"github.com/docker/docker/engine"
"github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/log"
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/pkg/parsers"
)

Expand Down
2 changes: 1 addition & 1 deletion graph/graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"github.com/docker/docker/dockerversion"
"github.com/docker/docker/image"
"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/runconfig"
"github.com/docker/docker/utils"
Expand Down
2 changes: 1 addition & 1 deletion graph/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/docker/docker/engine"
"github.com/docker/docker/image"
"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.
Expand Down
2 changes: 1 addition & 1 deletion graph/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

"github.com/docker/docker/engine"
"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/utils"
"github.com/docker/libtrust"
Expand Down
2 changes: 1 addition & 1 deletion graph/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

"github.com/docker/docker/engine"
"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/utils"
)
Expand Down
Loading

0 comments on commit 7c62cee

Please sign in to comment.