可配置是否存储连接

This commit is contained in:
2021-04-17 23:14:54 +08:00
parent 563c334757
commit 3548b434d0
2 changed files with 16 additions and 2 deletions

View File

@ -38,6 +38,8 @@ const (
DefaultLogLevel = zapcore.DebugLevel
// DefaultLogSplitInterval 默认的日志切割时间
DefaultLogSplitInterval = logger.TimeIntervalTypeHour
// DefaultStoreConnection 默认存储连接
DefaultStoreConnection = true
)
// WSServerConfig WS-Server的配置
@ -53,6 +55,7 @@ type WSServerConfig struct {
LogFile string // 日志文件名
LogLevel zapcore.Level // 日志等级
LogSplitInterval logger.TimeIntervalType // 日至切割的时间间隔
StoreConnection bool // 存储连接
}
// SetWSServerConfig 设置WS-Server的配置
@ -85,6 +88,17 @@ func SetWSServerLogEnable(logPath string, logFile string, logLevel zapcore.Level
}
}
// DisableStoreConnection 禁用连接存储
//
// Author : go_developer@163.com<张德满>
//
// Date : 11:10 下午 2021/4/17
func DisableStoreConnection() SetWSServerConfig {
return func(wsc *WSServerConfig) {
wsc.StoreConnection = true
}
}
// NewWSServerConfig 生成新的WS-Server配置
//
// Author : go_developer@163.com<张德满>