Browse code

Set uuid.Loggerf to nop on client and to logrus.Warnf on daemon

Signed-off-by: Tibor Vass <tibor@docker.com>

Tibor Vass authored on 2015/07/30 06:47:30
Showing 2 changed files
... ...
@@ -10,6 +10,7 @@ import (
10 10
 	"os"
11 11
 	"strings"
12 12
 
13
+	"github.com/docker/distribution/uuid"
13 14
 	"github.com/docker/docker/cli"
14 15
 	"github.com/docker/docker/cliconfig"
15 16
 	"github.com/docker/docker/opts"
... ...
@@ -98,6 +99,10 @@ func NewDockerCli(in io.ReadCloser, out, err io.Writer, clientFlags *cli.ClientF
98 98
 	}
99 99
 
100 100
 	cli.init = func() error {
101
+
102
+		// ignore errors from uuid package when running client commands
103
+		uuid.Loggerf = func(string, ...interface{}) {}
104
+
101 105
 		clientFlags.PostParse()
102 106
 
103 107
 		hosts := clientFlags.Common.Hosts
... ...
@@ -13,6 +13,7 @@ import (
13 13
 	"time"
14 14
 
15 15
 	"github.com/Sirupsen/logrus"
16
+	"github.com/docker/distribution/uuid"
16 17
 	apiserver "github.com/docker/docker/api/server"
17 18
 	"github.com/docker/docker/autogen/dockerversion"
18 19
 	"github.com/docker/docker/cli"
... ...
@@ -154,6 +155,9 @@ func getGlobalFlag() (globalFlag *flag.Flag) {
154 154
 
155 155
 // CmdDaemon is the daemon command, called the raw arguments after `docker daemon`.
156 156
 func (cli *DaemonCli) CmdDaemon(args ...string) error {
157
+	// warn from uuid package when running the daemon
158
+	uuid.Loggerf = logrus.Warnf
159
+
157 160
 	if *flDaemon {
158 161
 		// allow legacy forms `docker -D -d` and `docker -d -D`
159 162
 		logrus.Warn("please use 'docker daemon' instead.")