diff --git a/glide.yaml b/glide.yaml index a8c23f1..2650089 100644 --- a/glide.yaml +++ b/glide.yaml @@ -1,5 +1,4 @@ package: git.loafle.net/commons_go/logging import: -- package: go.uber.org/zap - version: v1.5.0 - package: git.loafle.net/commons_go/config +- package: go.uber.org/zap diff --git a/logging.go b/logging.go index e1834d0..d2f8c64 100644 --- a/logging.go +++ b/logging.go @@ -1,42 +1,25 @@ package logging import ( - "encoding/json" - "git.loafle.net/commons_go/config" "go.uber.org/zap" ) -type loggerKeyType int - -const loggerKey loggerKeyType = iota - var Logger *zap.Logger func init() { - conf := config.New() - conf.SetConfigName("logging") - conf.SetConfigType("json") - conf.AddConfigPath(".") - conf.AddConfigPath("./config") - err := conf.ReadInConfig() - if nil != err { - panic(err) - } - - buf, err := conf.Marshal("json") - if err != nil { - panic(err) - } var cfg zap.Config - if err = json.Unmarshal(buf, &cfg); err != nil { + var err error + + conf := config.New() + conf.SetConfigPath("./config") + + if err = conf.Load(&cfg, "logging.json"); nil != err { panic(err) } - Logger, err = cfg.Build() - if err != nil { + if Logger, err = cfg.Build(); nil != err { panic(err) } - }