Browse code

Remove use of "DEBUG" env var from CLI and decouple DEBUG from --log-level

Signed-off-by: Doug Davis <dug@us.ibm.com>

Doug Davis authored on 2015/04/01 05:49:41
Showing 3 changed files
... ...
@@ -3,7 +3,6 @@ package client
3 3
 import (
4 4
 	"encoding/json"
5 5
 	"fmt"
6
-	"os"
7 6
 
8 7
 	"github.com/docker/docker/api/types"
9 8
 	flag "github.com/docker/docker/pkg/mflag"
... ...
@@ -45,9 +44,8 @@ func (cli *DockerCli) CmdInfo(args ...string) error {
45 45
 	fmt.Fprintf(cli.out, "Name: %s\n", info.Name)
46 46
 	fmt.Fprintf(cli.out, "ID: %s\n", info.ID)
47 47
 
48
-	if info.Debug || os.Getenv("DEBUG") != "" {
48
+	if info.Debug {
49 49
 		fmt.Fprintf(cli.out, "Debug mode (server): %v\n", info.Debug)
50
-		fmt.Fprintf(cli.out, "Debug mode (client): %v\n", os.Getenv("DEBUG") != "")
51 50
 		fmt.Fprintf(cli.out, "File Descriptors: %d\n", info.NFd)
52 51
 		fmt.Fprintf(cli.out, "Goroutines: %d\n", info.NGoroutines)
53 52
 		fmt.Fprintf(cli.out, "System Time: %s\n", info.SystemTime)
... ...
@@ -52,11 +52,8 @@ func main() {
52 52
 		setLogLevel(logrus.InfoLevel)
53 53
 	}
54 54
 
55
-	// -D, --debug, -l/--log-level=debug processing
56
-	// When/if -D is removed this block can be deleted
57 55
 	if *flDebug {
58 56
 		os.Setenv("DEBUG", "1")
59
-		setLogLevel(logrus.DebugLevel)
60 57
 	}
61 58
 
62 59
 	if len(flHosts) == 0 {
... ...
@@ -229,8 +229,8 @@ func (s *DockerDaemonSuite) TestDaemonFlagD(c *check.C) {
229 229
 		c.Fatal(err)
230 230
 	}
231 231
 	content, _ := ioutil.ReadFile(s.d.logFile.Name())
232
-	if !strings.Contains(string(content), `level=debug`) {
233
-		c.Fatalf(`Missing level="debug" in log file using -D:\n%s`, string(content))
232
+	if strings.Contains(string(content), `level=debug`) {
233
+		c.Fatalf(`Should not have level="debug" in log file using -D:\n%s`, string(content))
234 234
 	}
235 235
 }
236 236
 
... ...
@@ -239,8 +239,8 @@ func (s *DockerDaemonSuite) TestDaemonFlagDebug(c *check.C) {
239 239
 		c.Fatal(err)
240 240
 	}
241 241
 	content, _ := ioutil.ReadFile(s.d.logFile.Name())
242
-	if !strings.Contains(string(content), `level=debug`) {
243
-		c.Fatalf(`Missing level="debug" in log file using --debug:\n%s`, string(content))
242
+	if strings.Contains(string(content), `level=debug`) {
243
+		c.Fatalf(`Should not have level="debug" in log file using --debug:\n%s`, string(content))
244 244
 	}
245 245
 }
246 246
 
... ...
@@ -249,8 +249,8 @@ func (s *DockerDaemonSuite) TestDaemonFlagDebugLogLevelFatal(c *check.C) {
249 249
 		c.Fatal(err)
250 250
 	}
251 251
 	content, _ := ioutil.ReadFile(s.d.logFile.Name())
252
-	if !strings.Contains(string(content), `level=debug`) {
253
-		c.Fatalf(`Missing level="debug" in log file when using both --debug and --log-level=fatal:\n%s`, string(content))
252
+	if strings.Contains(string(content), `level=debug`) {
253
+		c.Fatalf(`Should not have level="debug" in log file when using both --debug and --log-level=fatal:\n%s`, string(content))
254 254
 	}
255 255
 }
256 256