Add a flag to hide libmachine logs.
These logs often reference docker-machine itself, which is confusing to users. We should log everything we need to ourselves.pull/144/head
parent
c993bf8cca
commit
44567c03d8
|
@ -18,8 +18,10 @@ package cmd
|
|||
|
||||
import (
|
||||
goflag "flag"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"github.com/docker/machine/libmachine/log"
|
||||
"github.com/golang/glog"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/pflag"
|
||||
|
@ -31,6 +33,10 @@ var dirs = [...]string{
|
|||
constants.MakeMiniPath("certs"),
|
||||
constants.MakeMiniPath("machines")}
|
||||
|
||||
var (
|
||||
showLibmachineLogs bool
|
||||
)
|
||||
|
||||
// RootCmd represents the base command when called without any subcommands
|
||||
var RootCmd = &cobra.Command{
|
||||
Use: "minikube",
|
||||
|
@ -42,6 +48,11 @@ var RootCmd = &cobra.Command{
|
|||
glog.Exitf("Error creating minikube directory: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
if !showLibmachineLogs {
|
||||
log.SetOutWriter(ioutil.Discard)
|
||||
log.SetErrWriter(ioutil.Discard)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -54,6 +65,7 @@ func Execute() {
|
|||
}
|
||||
|
||||
func init() {
|
||||
RootCmd.PersistentFlags().BoolVarP(&showLibmachineLogs, "show-libmachine-logs", "", false, "Whether or not to show logs from libmachine.")
|
||||
pflag.CommandLine.AddGoFlagSet(goflag.CommandLine)
|
||||
cobra.OnInitialize(initConfig)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue