2017-08-30 04:03:03 +00:00
|
|
|
package logging
|
|
|
|
|
|
|
|
import (
|
2017-09-11 03:42:00 +00:00
|
|
|
"git.loafle.net/commons_go/config"
|
2017-08-30 04:03:03 +00:00
|
|
|
|
2017-08-30 05:00:22 +00:00
|
|
|
"go.uber.org/zap"
|
2017-08-30 04:03:03 +00:00
|
|
|
)
|
|
|
|
|
2017-09-11 03:42:00 +00:00
|
|
|
var Logger *zap.Logger
|
2017-08-30 04:03:03 +00:00
|
|
|
|
|
|
|
func init() {
|
2017-09-19 06:00:20 +00:00
|
|
|
var cfg zap.Config
|
|
|
|
var err error
|
|
|
|
|
2017-09-11 03:42:00 +00:00
|
|
|
conf := config.New()
|
2017-09-19 06:00:20 +00:00
|
|
|
conf.SetConfigPath("./config")
|
2017-08-30 04:03:03 +00:00
|
|
|
|
2017-09-19 06:00:20 +00:00
|
|
|
if err = conf.Load(&cfg, "logging.json"); nil != err {
|
2017-09-11 03:42:00 +00:00
|
|
|
panic(err)
|
2017-08-30 04:03:03 +00:00
|
|
|
}
|
2017-09-11 03:42:00 +00:00
|
|
|
|
2017-09-19 06:00:20 +00:00
|
|
|
if Logger, err = cfg.Build(); nil != err {
|
2017-09-11 03:42:00 +00:00
|
|
|
panic(err)
|
|
|
|
}
|
2017-08-30 04:03:03 +00:00
|
|
|
}
|