Преглед на файлове

Merge pull request #11965 from duglin/DEBUG

Remove use of "DEBUG" env var from CLI and de-couple -D from --log-level
Jessie Frazelle преди 10 години
родител
ревизия
36d995a291
променени са 3 файла, в които са добавени 7 реда и са изтрити 12 реда
  1. 1 3
      api/client/info.go
  2. 0 3
      docker/docker.go
  3. 6 6
      integration-cli/docker_cli_daemon_test.go

+ 1 - 3
api/client/info.go

@@ -3,7 +3,6 @@ package client
 import (
 import (
 	"encoding/json"
 	"encoding/json"
 	"fmt"
 	"fmt"
-	"os"
 
 
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types"
 	flag "github.com/docker/docker/pkg/mflag"
 	flag "github.com/docker/docker/pkg/mflag"
@@ -45,9 +44,8 @@ func (cli *DockerCli) CmdInfo(args ...string) error {
 	fmt.Fprintf(cli.out, "Name: %s\n", info.Name)
 	fmt.Fprintf(cli.out, "Name: %s\n", info.Name)
 	fmt.Fprintf(cli.out, "ID: %s\n", info.ID)
 	fmt.Fprintf(cli.out, "ID: %s\n", info.ID)
 
 
-	if info.Debug || os.Getenv("DEBUG") != "" {
+	if info.Debug {
 		fmt.Fprintf(cli.out, "Debug mode (server): %v\n", info.Debug)
 		fmt.Fprintf(cli.out, "Debug mode (server): %v\n", info.Debug)
-		fmt.Fprintf(cli.out, "Debug mode (client): %v\n", os.Getenv("DEBUG") != "")
 		fmt.Fprintf(cli.out, "File Descriptors: %d\n", info.NFd)
 		fmt.Fprintf(cli.out, "File Descriptors: %d\n", info.NFd)
 		fmt.Fprintf(cli.out, "Goroutines: %d\n", info.NGoroutines)
 		fmt.Fprintf(cli.out, "Goroutines: %d\n", info.NGoroutines)
 		fmt.Fprintf(cli.out, "System Time: %s\n", info.SystemTime)
 		fmt.Fprintf(cli.out, "System Time: %s\n", info.SystemTime)

+ 0 - 3
docker/docker.go

@@ -53,11 +53,8 @@ func main() {
 		setLogLevel(logrus.InfoLevel)
 		setLogLevel(logrus.InfoLevel)
 	}
 	}
 
 
-	// -D, --debug, -l/--log-level=debug processing
-	// When/if -D is removed this block can be deleted
 	if *flDebug {
 	if *flDebug {
 		os.Setenv("DEBUG", "1")
 		os.Setenv("DEBUG", "1")
-		setLogLevel(logrus.DebugLevel)
 	}
 	}
 
 
 	if len(flHosts) == 0 {
 	if len(flHosts) == 0 {

+ 6 - 6
integration-cli/docker_cli_daemon_test.go

@@ -232,8 +232,8 @@ func (s *DockerDaemonSuite) TestDaemonFlagD(c *check.C) {
 		c.Fatal(err)
 		c.Fatal(err)
 	}
 	}
 	content, _ := ioutil.ReadFile(s.d.logFile.Name())
 	content, _ := ioutil.ReadFile(s.d.logFile.Name())
-	if !strings.Contains(string(content), `level=debug`) {
-		c.Fatalf(`Missing level="debug" in log file using -D:\n%s`, string(content))
+	if strings.Contains(string(content), `level=debug`) {
+		c.Fatalf(`Should not have level="debug" in log file using -D:\n%s`, string(content))
 	}
 	}
 }
 }
 
 
@@ -242,8 +242,8 @@ func (s *DockerDaemonSuite) TestDaemonFlagDebug(c *check.C) {
 		c.Fatal(err)
 		c.Fatal(err)
 	}
 	}
 	content, _ := ioutil.ReadFile(s.d.logFile.Name())
 	content, _ := ioutil.ReadFile(s.d.logFile.Name())
-	if !strings.Contains(string(content), `level=debug`) {
-		c.Fatalf(`Missing level="debug" in log file using --debug:\n%s`, string(content))
+	if strings.Contains(string(content), `level=debug`) {
+		c.Fatalf(`Should not have level="debug" in log file using --debug:\n%s`, string(content))
 	}
 	}
 }
 }
 
 
@@ -252,8 +252,8 @@ func (s *DockerDaemonSuite) TestDaemonFlagDebugLogLevelFatal(c *check.C) {
 		c.Fatal(err)
 		c.Fatal(err)
 	}
 	}
 	content, _ := ioutil.ReadFile(s.d.logFile.Name())
 	content, _ := ioutil.ReadFile(s.d.logFile.Name())
-	if !strings.Contains(string(content), `level=debug`) {
-		c.Fatalf(`Missing level="debug" in log file when using both --debug and --log-level=fatal:\n%s`, string(content))
+	if strings.Contains(string(content), `level=debug`) {
+		c.Fatalf(`Should not have level="debug" in log file when using both --debug and --log-level=fatal:\n%s`, string(content))
 	}
 	}
 }
 }