naming of constants

This commit is contained in:
Alex Dadgar 2018-05-09 16:46:52 -07:00
parent 0e79e1a46e
commit e067a9ae06

View file

@ -15,8 +15,11 @@ import (
) )
const ( const (
bufSize = 32768 // logBufferSize is the size of the buffer.
flushDur = 100 * time.Millisecond logBufferSize = 32768
// bufferFlushDuration is the duration at which we flush the buffer.
bufferFlushDuration = 100 * time.Millisecond
) )
// FileRotator writes bytes to a rotated set of files // FileRotator writes bytes to a rotated set of files
@ -53,7 +56,7 @@ func NewFileRotator(path string, baseFile string, maxFiles int,
path: path, path: path,
baseFileName: baseFile, baseFileName: baseFile,
flushTicker: time.NewTicker(flushDur), flushTicker: time.NewTicker(bufferFlushDuration),
logger: logger, logger: logger,
purgeCh: make(chan struct{}, 1), purgeCh: make(chan struct{}, 1),
doneCh: make(chan struct{}, 1), doneCh: make(chan struct{}, 1),
@ -283,7 +286,7 @@ func (f *FileRotator) createOrResetBuffer() {
f.bufLock.Lock() f.bufLock.Lock()
defer f.bufLock.Unlock() defer f.bufLock.Unlock()
if f.bufw == nil { if f.bufw == nil {
f.bufw = bufio.NewWriterSize(f.currentFile, bufSize) f.bufw = bufio.NewWriterSize(f.currentFile, logBufferSize)
} else { } else {
f.bufw.Reset(f.currentFile) f.bufw.Reset(f.currentFile)
} }