diff --git a/logging.go b/logging.go index e1834d0..e994a57 100644 --- a/logging.go +++ b/logging.go @@ -2,6 +2,7 @@ package logging import ( "encoding/json" + "flag" "git.loafle.net/commons_go/config" @@ -15,11 +16,16 @@ const loggerKey loggerKeyType = iota var Logger *zap.Logger func init() { + configPath := flag.String("config", ".", "The path of config") + flag.Parse() + + log.Printf("logging: config path[%s]", *configPath) + conf := config.New() conf.SetConfigName("logging") conf.SetConfigType("json") - conf.AddConfigPath(".") - conf.AddConfigPath("./config") + conf.AddConfigPath(*configPath) + // conf.AddConfigPath("./config") err := conf.ReadInConfig() if nil != err { panic(err)