From 12869d1ec09bac971230128d4dc49a6ca1e9ee62 Mon Sep 17 00:00:00 2001 From: Elara Musayelyan Date: Fri, 9 Jun 2023 12:33:39 -0700 Subject: [PATCH] Only enable debug logging if debug flag is set --- main.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 789a68b..c1224bf 100644 --- a/main.go +++ b/main.go @@ -41,7 +41,6 @@ import ( func init() { log.Logger = logger.NewPretty(os.Stderr) - log.Logger.SetLevel(logger.LogLevelDebug) } func main() { @@ -51,8 +50,13 @@ func main() { serverAddr := pflag.StringP("address", "a", ":8080", "Webhook server address") genHash := pflag.BoolP("gen-hash", "g", false, "Generate a password hash for webhooks") useEnv := pflag.BoolP("use-env", "E", false, "Use environment variables for configuration") + debug := pflag.BoolP("debug", "d", false, "Enable debug logging") pflag.Parse() + if *debug { + log.Logger.SetLevel(logger.LogLevelDebug) + } + if *genHash { fmt.Print("Password: ") pwd, err := term.ReadPassword(int(os.Stdin.Fd()))