From 0e28dd6942c8a7207146f6a6b542bc45f75462b0 Mon Sep 17 00:00:00 2001 From: panlei <2799247126@qq.com> Date: 星期一, 16 十二月 2019 13:35:26 +0800 Subject: [PATCH] --- --- main.go | 34 ++++++++++++++++++++-------------- 1 files changed, 20 insertions(+), 14 deletions(-) diff --git a/main.go b/main.go index 0450e64..7c8f61c 100644 --- a/main.go +++ b/main.go @@ -3,13 +3,16 @@ import ( "flag" + "fmt" + "github.com/spf13/viper" "sync" "net/http" _ "net/http/pprof" "plugin" //"github.com/spf13/viper" - logger "github.com/alecthomas/log4go" + //"basic.com/valib/logger.git" + "basic.com/valib/logger.git" "github.com/panjf2000/ants/v2" "basic.com/pubsub/protomsg.git" @@ -32,18 +35,18 @@ flag.Parse() // 鏃ュ織鍒濆鍖� - insertdata.Init(*env) - //var logFile = "./logger/" - //if viper.GetString("LogBasePath") != "" { - // logFile = viper.GetString("LogBasePath") - //} - //logFile = logFile + "ruleprocess.log" - //fmt.Println("鏃ュ織鍦板潃锛�",logFile) - //logger.Config(logFile, logger.DebugLevel) - //logger.SetSaveDays(7) + structure.Init(*env) + var logFile = "./logger/" + if viper.GetString("LogBasePath") != "" { + logFile = viper.GetString("LogBasePath") + } + logFile = logFile + "ruleprocess.log" + fmt.Println("鏃ュ織鍦板潃锛�",logFile) + logger.Config(logFile, logger.DebugLevel) + logger.SetSaveDays(7) // log4go - logger.LoadConfiguration("./logger/log.xml") - logger.Info("鏃ュ織鍒濆鍖栨垚鍔燂紒") + //logger.LoadConfiguration("./logger/log.xml") + logger.Info("鏃ュ織鍒濆鍖栨垚鍔燂紒",logFile) } func main() { @@ -76,7 +79,7 @@ func nRecvImpl(c deliver.Deliver, index int) { var msg []byte //var wg1 sync.WaitGroup - //p,_ := ants.NewPool(100) + //p,_ := ants.NewPool(20) //syncCalculateSum := func() { // Task(msg) // wg1.Done() @@ -88,7 +91,10 @@ if err == nil { //wg1.Add(1) //_ = p.Submit(syncCalculateSum) - go Task(msg) + Task(msg) + } else { + //fmt.Println(err) + //logger.Info(err) } } } -- Gitblit v1.8.0