zerolog icon indicating copy to clipboard operation
zerolog copied to clipboard

Add support for flag.Value to zerolog.Level

Open belak opened this issue 3 years ago • 0 comments

As far as I know, it would be as simple as the following (though an optional strings.ToLower could be used for convenience):

func (l *Level) Set(val string) error {
	level, err := zerolog.ParseLevel(val)
	if err == nil {
		*ll = level
	}
	return err
}

This would allow zerolog.Level to be used with flag.Var and allow people to avoid creating wrapper types to use when setting variables via flags. I just wanted to float it here to see if it would be accepted before I made a PR for it.

belak avatar Jul 25 '21 08:07 belak