options.go 408 B

12345678910111213141516171819202122
  1. package main
  2. import (
  3. "fmt"
  4. "github.com/nsqio/nsq/internal/lg"
  5. )
  6. type config map[string]interface{}
  7. // Validate settings in the config file, and fatal on errors
  8. func (cfg config) Validate() {
  9. if v, exists := cfg["log_level"]; exists {
  10. var t lg.LogLevel
  11. err := t.Set(fmt.Sprintf("%v", v))
  12. if err == nil {
  13. cfg["log_level"] = t
  14. } else {
  15. logFatal("failed parsing log_level %+v", v)
  16. }
  17. }
  18. }