Merge pull request #1716 from ibuildthecloud/debugpublic

Make debug variable public to be used by wrapper programs
pull/1752/head
Erik Wilson 2020-05-04 20:50:36 -07:00 committed by GitHub
commit c71561129e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -103,6 +103,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