增加配置初始值检测

This commit is contained in:
2025-04-27 14:51:42 +08:00
parent ea78e582bb
commit f6a779fad7
2 changed files with 12 additions and 2 deletions

View File

@ -21,6 +21,15 @@ import (
)
func NewZincLogConnect(cfg *ZincConfig) io.Writer {
if cfg.Timeout <= 0 {
cfg.Timeout = DefaultTimeout
}
if cfg.BufferSize <= 0 {
cfg.BufferSize = DefaultBufferSize
}
if cfg.ForceSyncTime <= 0 {
cfg.ForceSyncTime = DefaultForceFlushLogTime
}
zlc := &zincLogConnect{
config: cfg,
lock: &sync.RWMutex{},