Skip to content

Commit 06e6e15

Browse files
committed
set default log level to 'error'
To enable more verbosity, set env var 'GIT_IAP_DEBUG=1'
1 parent ab83b66 commit 06e6e15

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

cmd/git-remote-https+iap/main.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"fmt"
55
_url "net/url"
66
"os"
7+
"strconv"
78
"strings"
89
"time"
910

@@ -16,6 +17,9 @@ import (
1617

1718
const (
1819
BinaryName = "git-remote-https+iap"
20+
21+
// DebugEnvVariable is the name of the environment variable that needs to be set in order to enable debug logging
22+
DebugEnvVariable = "GIT_IAP_VERBOSE"
1923
)
2024

2125
var (
@@ -64,8 +68,11 @@ func init() {
6468
configureCmd.MarkFlagRequired("clientID")
6569
rootCmd.AddCommand(configureCmd)
6670

67-
// set default log level
68-
zerolog.SetGlobalLevel(zerolog.DebugLevel)
71+
// set log level
72+
zerolog.SetGlobalLevel(zerolog.ErrorLevel)
73+
if debug, _ := strconv.ParseBool(os.Getenv(DebugEnvVariable)); debug {
74+
zerolog.SetGlobalLevel(zerolog.DebugLevel)
75+
}
6976
}
7077

7178
func main() {

0 commit comments

Comments
 (0)