|
|
@ -5,6 +5,7 @@ import ( |
|
|
|
"io/ioutil" |
|
|
|
"os" |
|
|
|
"zinx/ziface" |
|
|
|
"zinx/zlog" |
|
|
|
) |
|
|
|
|
|
|
|
/* |
|
|
@ -34,6 +35,13 @@ type GlobalObj struct { |
|
|
|
config file path |
|
|
|
*/ |
|
|
|
ConfFilePath string |
|
|
|
|
|
|
|
/* |
|
|
|
logger |
|
|
|
*/ |
|
|
|
LogDir string //日志所在文件夹 默认"./log"
|
|
|
|
LogFile string //日志文件名称 默认"" --如果没有设置日志文件,打印信息将打印至stderr
|
|
|
|
LogDebugClose bool //是否关闭Debug日志级别调试信息 默认false -- 默认打开debug信息
|
|
|
|
} |
|
|
|
|
|
|
|
/* |
|
|
@ -70,6 +78,14 @@ func (g *GlobalObj) Reload() { |
|
|
|
if err != nil { |
|
|
|
panic(err) |
|
|
|
} |
|
|
|
|
|
|
|
//Logger 设置
|
|
|
|
if g.LogFile != "" { |
|
|
|
zlog.SetLogFile(g.LogDir, g.LogFile) |
|
|
|
} |
|
|
|
if g.LogDebugClose == true { |
|
|
|
zlog.CloseDebug() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/* |
|
|
@ -87,7 +103,10 @@ func init() { |
|
|
|
ConfFilePath: "conf/zinx.json", |
|
|
|
WorkerPoolSize: 10, |
|
|
|
MaxWorkerTaskLen: 1024, |
|
|
|
MaxMsgChanLen:1024, |
|
|
|
MaxMsgChanLen: 1024, |
|
|
|
LogDir: "./log", |
|
|
|
LogFile: "", |
|
|
|
LogDebugClose: false, |
|
|
|
} |
|
|
|
|
|
|
|
//从配置文件中加载一些用户配置的参数
|
|
|
|