File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -39,15 +39,27 @@ func (o *Options) UnmarshalText(text []byte) error {
3939 return nil
4040}
4141
42+ // UnmarshalYAML implements yaml.InterfaceUnmarshaler to allow Options to be parsed go-yaml.
43+ func (o * Options ) UnmarshalYAML (unmarshal func (any ) error ) error {
44+ optionsMap := make (map [string ]zapcore.Level )
45+
46+ if err := unmarshal (& optionsMap ); err != nil {
47+ return err
48+ }
49+
50+ * o = optionsMap
51+
52+ return nil
53+ }
54+
4255// Config defines Logger configuration.
4356type Config struct {
4457 // zapcore.Level at 0 is for info level.
4558 Level zapcore.Level `yaml:"level" env:"LEVEL" default:"0"`
4659 Output string `yaml:"output" env:"OUTPUT"`
4760 // Interval for periodic logging.
4861 Interval time.Duration `yaml:"interval" env:"INTERVAL" default:"20s"`
49-
50- Options `yaml:"options" env:"OPTIONS"`
62+ Options Options `yaml:"options" env:"OPTIONS"`
5163}
5264
5365// SetDefaults implements defaults.Setter to configure the log output if it is not set:
You can’t perform that action at this time.
0 commit comments