Skip to content

Commit 3372ba2

Browse files
committed
logs: readd verbose flag
1 parent b0290e8 commit 3372ba2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

main.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ const (
3434
type globalOptions struct {
3535
ErrorOnExisting bool `long:"error-on-existing" short:"e" description:"Exit with code EXIT_CODE_TARGET_EXISTS (128) instead of 0 if the result of an action is already present"`
3636
DebugLevel string `long:"debuglevel" short:"d" description:"Set the log level (Off, Critical, Error, Warn, Info, Debug, Trace)"`
37+
Verbose bool `long:"verbose" short:"v" description:"Turn on logging to stderr"`
3738
}
3839

3940
func main() {
@@ -43,6 +44,9 @@ func main() {
4344
// just the global options, we do a pre-parsing without any commands
4445
// registered yet. We ignore any errors as that'll be handled later.
4546
_, _ = flags.NewParser(globalOpts, flags.IgnoreUnknown).Parse()
47+
if globalOpts.Verbose {
48+
globalOpts.DebugLevel = "error"
49+
}
4650

4751
logger.Infof("Version %s commit=%s, debuglevel=%s", Version(), Commit,
4852
globalOpts.DebugLevel)

0 commit comments

Comments
 (0)