Make debug variable public to be used by wrapper programs

pull/1716/head
Darren Shepherd 2020-04-29 11:36:44 -07:00
parent 690a4ca7a4
commit 56770ff2cc
2 changed files with 5 additions and 5 deletions

View File

@ -95,6 +95,6 @@ func runWithLogging() error {
func setupLogging() {
flag.Set("v", strconv.Itoa(LogConfig.VLevel))
flag.Set("vmodule", LogConfig.VModule)
flag.Set("alsologtostderr", strconv.FormatBool(debug))
flag.Set("logtostderr", strconv.FormatBool(!debug))
flag.Set("alsologtostderr", strconv.FormatBool(Debug))
flag.Set("logtostderr", strconv.FormatBool(!Debug))
}

View File

@ -10,7 +10,7 @@ import (
)
var (
debug bool
Debug bool
)
func init() {
@ -32,13 +32,13 @@ func NewApp() *cli.App {
cli.BoolFlag{
Name: "debug",
Usage: "Turn on debug logs",
Destination: &debug,
Destination: &Debug,
EnvVar: "K3S_DEBUG",
},
}
app.Before = func(ctx *cli.Context) error {
if debug {
if Debug {
logrus.SetLevel(logrus.DebugLevel)
}
return nil