Commit 3c8c5de2 by zhengqiuyun86

初始化

parent f4ab4b6a
...@@ -44,9 +44,7 @@ func BaseConfig(conf Config) { ...@@ -44,9 +44,7 @@ func BaseConfig(conf Config) {
LogShowSql = conf.LogShowSql LogShowSql = conf.LogShowSql
Es = conf.Elasticsearch Es = conf.Elasticsearch
Redis = conf.Redis Redis = conf.Redis
MySql = conf.Mysql MySql = conf.Mysql
} }
......
...@@ -16,8 +16,7 @@ func TestLog() { ...@@ -16,8 +16,7 @@ func TestLog() {
var Client *elastic.Client var Client *elastic.Client
//初始化 func Init() {
func init() {
host := fmt.Sprintf("http://%s:%d", conf.Es.ServerHost, conf.Es.ServerPort) host := fmt.Sprintf("http://%s:%d", conf.Es.ServerHost, conf.Es.ServerPort)
var err error var err error
errorLog := _log.New(os.Stdout, "APP", _log.LstdFlags) errorLog := _log.New(os.Stdout, "APP", _log.LstdFlags)
......
...@@ -96,7 +96,7 @@ func commitTx(gid uint64, dbMap *sync.Map) { ...@@ -96,7 +96,7 @@ func commitTx(gid uint64, dbMap *sync.Map) {
} }
} }
func init() { func Init() {
newLogger := logger.New( newLogger := logger.New(
_log.New(os.Stdout, "", _log.Lmicroseconds), // io writer(日志输出的目标,前缀和日志包含的内容——译者注) _log.New(os.Stdout, "", _log.Lmicroseconds), // io writer(日志输出的目标,前缀和日志包含的内容——译者注)
logger.Config{ logger.Config{
......
...@@ -15,7 +15,7 @@ func TestLog() { ...@@ -15,7 +15,7 @@ func TestLog() {
var redisClient *redis.Client var redisClient *redis.Client
func init() { func Init() {
redisClient = redis.NewClient(&redis.Options{ redisClient = redis.NewClient(&redis.Options{
Addr: fmt.Sprintf("%s:%d", conf.Redis.RedisHost, conf.Redis.RedisPort), Addr: fmt.Sprintf("%s:%d", conf.Redis.RedisHost, conf.Redis.RedisPort),
Password: conf.Redis.RedisPwd, Password: conf.Redis.RedisPwd,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment