Only enable debug logging if debug flag is set
ci/woodpecker/push/woodpecker Pipeline was successful Details

This commit is contained in:
Elara 2023-06-09 12:33:39 -07:00
parent 0341c7c6b3
commit 12869d1ec0
1 changed files with 5 additions and 1 deletions

View File

@ -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()))