Skip to content

Commit 3db12ec

Browse files
committed
remove global verbose flag
It is not widely used. Just in one command. It is to us to make decision what to show to user. If really needed we should put that flag only to the specific command.
1 parent 645625e commit 3db12ec

File tree

2 files changed

+2
-20
lines changed

2 files changed

+2
-20
lines changed

cli/cmd/root.go

+1-5
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,10 @@ func Execute(ctx context.Context, version string) error {
3939
}
4040

4141
// register global flags
42-
var verbose, noColor bool
43-
cmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "verbose log output")
42+
var noColor bool
4443
cmd.PersistentFlags().BoolVar(&noColor, "no-color", false, "don't use color in log output")
4544
// use global flags
4645
cobra.OnInitialize(func() {
47-
if verbose {
48-
log.EnableDebugLogLevel()
49-
}
5046
if noColor {
5147
log.UI.DisableColor()
5248
}

cli/log/log.go

+1-15
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,6 @@ import (
1212
"github.com/pkg/errors"
1313
)
1414

15-
var (
16-
debugLogLevelEnabled = false
17-
)
18-
19-
func EnableDebugLogLevel() {
20-
debugLogLevelEnabled = true
21-
}
22-
2315
func (u *UILogger) DisableColor() {
2416
print := func(a ...interface{}) {
2517
fmt.Print(a...)
@@ -110,9 +102,6 @@ func (u *UILogger) Info(format string, v ...interface{}) {
110102
}
111103

112104
func (u *UILogger) Debug(format string, v ...interface{}) {
113-
if !debugLogLevelEnabled {
114-
return
115-
}
116105
u.debugLog(fmt.Sprintf(format, v...))
117106
}
118107

@@ -149,16 +138,13 @@ func (u *UILogger) Backend(msg string) {
149138
u.infoLog(fmt.Sprintf("λ %s", msg))
150139
return
151140
}
152-
if l.Level == levelDebug && !debugLogLevelEnabled {
153-
return
154-
}
155141
c := u.levelColor(l.Level)
156142
c(fmt.Sprintf("λ %s", l.Msg))
157143
}
158144

159145
const (
160-
levelInfo = "info"
161146
levelDebug = "debug"
147+
levelInfo = "info"
162148
levelError = "error"
163149
)
164150

0 commit comments

Comments
 (0)