From 56770ff2cc84a8821a41961f627ea09462584480 Mon Sep 17 00:00:00 2001 From: Darren Shepherd Date: Wed, 29 Apr 2020 11:36:44 -0700 Subject: [PATCH] Make debug variable public to be used by wrapper programs --- pkg/cli/cmds/log.go | 4 ++-- pkg/cli/cmds/root.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/cli/cmds/log.go b/pkg/cli/cmds/log.go index 3ae6803db5..5dd35cc4c6 100644 --- a/pkg/cli/cmds/log.go +++ b/pkg/cli/cmds/log.go @@ -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)) } diff --git a/pkg/cli/cmds/root.go b/pkg/cli/cmds/root.go index c612ef3740..387f79882a 100644 --- a/pkg/cli/cmds/root.go +++ b/pkg/cli/cmds/root.go @@ -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