package logger import ( "git.linuxforward.com/byom/byom-golang-lib/pkg/errors" "github.com/sirupsen/logrus" ) // Config holds the logger configuration type Config struct { Level string `yaml:"level"` Format string `yaml:"format"` // "json" or "text" NoColor bool `yaml:"no_color"` } // Validate implements the config.Validator interface func (c *Config) Validate() error { if c.Level == "" { c.Level = "info" } if c.Format == "" { c.Format = "text" } // Validate log level _, err := logrus.ParseLevel(c.Level) if err != nil { return errors.NewConfigError("log.level", err) } return nil }