saucelabs/forwarder

log: error level is not recognised as default by anyflag

Closed this issue · 1 comments

Error level evaluates to 0:

const (
	ErrorLevel Level = iota
	InfoLevel
	DebugLevel
)

That makes anyflag ignore this value as default:

func (v *Value[T]) String() string {
	if v.redact != nil {
		return v.redact(*v.value)
	}

	if v.value == nil || reflect.ValueOf(*v.value).IsZero() {
		return ""
	}
	return fmt.Sprint(*v.value)
}

As a result, default log level is not printed in help:

    --log-level <error|info|debug> (env FORWARDER_LOG_LEVEL)
        Log level.

How about starting form 1 making 0 undefined?