优化日志库-新增Buff数量,减少多协程并发写锁等待

This commit is contained in:
boyce
2021-07-01 18:24:25 +08:00
parent a0594cb945
commit 17601f1831
3 changed files with 221 additions and 184 deletions

View File

@@ -163,7 +163,7 @@ func initLog() error{
localnodeinfo := cluster.GetCluster().GetLocalNodeInfo()
filepre := fmt.Sprintf("%s_%d_", localnodeinfo.NodeName, localnodeinfo.NodeId)
logger,err := log.New(logLevel,logPath,filepre,slog.LstdFlags|slog.Lshortfile)
logger,err := log.New(logLevel,logPath,filepre,slog.LstdFlags|slog.Lshortfile,10)
if err != nil {
fmt.Printf("cannot create log file!\n")
return err
@@ -287,7 +287,7 @@ func GetConfigDir() string {
}
func SetSysLog(strLevel string, pathname string, flag int){
logs,_:= log.New(strLevel,pathname, "", flag)
logs,_:= log.New(strLevel,pathname, "", flag,10)
log.Export(logs)
}