ing
This commit is contained in:
parent
25aa9161b8
commit
18bb52405c
10
logging.go
10
logging.go
|
@ -2,6 +2,7 @@ package logging
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"flag"
|
||||||
|
|
||||||
"git.loafle.net/commons_go/config"
|
"git.loafle.net/commons_go/config"
|
||||||
|
|
||||||
|
@ -15,11 +16,16 @@ const loggerKey loggerKeyType = iota
|
||||||
var Logger *zap.Logger
|
var Logger *zap.Logger
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
configPath := flag.String("config", ".", "The path of config")
|
||||||
|
flag.Parse()
|
||||||
|
|
||||||
|
log.Printf("logging: config path[%s]", *configPath)
|
||||||
|
|
||||||
conf := config.New()
|
conf := config.New()
|
||||||
conf.SetConfigName("logging")
|
conf.SetConfigName("logging")
|
||||||
conf.SetConfigType("json")
|
conf.SetConfigType("json")
|
||||||
conf.AddConfigPath(".")
|
conf.AddConfigPath(*configPath)
|
||||||
conf.AddConfigPath("./config")
|
// conf.AddConfigPath("./config")
|
||||||
err := conf.ReadInConfig()
|
err := conf.ReadInConfig()
|
||||||
if nil != err {
|
if nil != err {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user