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() { func setupLogging() {
flag.Set("v", strconv.Itoa(LogConfig.VLevel)) flag.Set("v", strconv.Itoa(LogConfig.VLevel))
flag.Set("vmodule", LogConfig.VModule) flag.Set("vmodule", LogConfig.VModule)
flag.Set("alsologtostderr", strconv.FormatBool(debug)) flag.Set("alsologtostderr", strconv.FormatBool(Debug))
flag.Set("logtostderr", strconv.FormatBool(!debug)) flag.Set("logtostderr", strconv.FormatBool(!Debug))
} }

View File

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