提交 438db81d 编写于 作者: M Matt Rickard

Set log levels in command prerun

If this is called in init, glog and viper haven't been properly set up
yet, so it does not trigger the logging output.
上级 43239ac7
......@@ -78,6 +78,17 @@ var RootCmd = &cobra.Command{
}
}
// Log level 3 or greater enables libmachine logs
if !glog.V(3) {
log.SetOutWriter(ioutil.Discard)
log.SetErrWriter(ioutil.Discard)
}
// Log level 7 or greater enables debug level logs
if glog.V(7) {
log.SetDebug(true)
}
if viper.GetBool(showLibmachineLogs) {
fmt.Println(`
--show-libmachine-logs is deprecated.
......@@ -128,17 +139,6 @@ func init() {
//TODO(r2d4): config should not reference API
clientType = configCmd.GetClientType()
// Log level 3 or greater enables libmachine logs
if !glog.V(3) {
log.SetOutWriter(ioutil.Discard)
log.SetErrWriter(ioutil.Discard)
}
// Log level 7 or greater enables debug level logs
if glog.V(7) {
log.SetDebug(true)
}
if enableUpdateNotification {
notify.MaybePrintUpdateTextFromGithub(os.Stderr)
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册