2
0

cleanup and module support (#77)

* cleanup and module support
This commit is contained in:
Lukas Rist
2020-10-21 16:19:57 +02:00
committed by GitHub
parent 94d9e492cc
commit 47ffae2331
8 changed files with 45 additions and 30 deletions
+5 -5
View File
@@ -120,7 +120,7 @@ var (
currentTime = time.Now
// os_Stat exists so it can be mocked out by tests.
os_Stat = os.Stat
osStat = os.Stat
// megabyte is the conversion factor between MaxSize and bytes. It is a
// variable so tests can mock it out and not need to write megabytes of data
@@ -213,7 +213,7 @@ func (l *Logger) openNew() error {
name := l.filename()
mode := os.FileMode(0600)
info, err := os_Stat(name)
info, err := osStat(name)
if err == nil {
// Copy the mode off the old logfile.
mode = info.Mode()
@@ -265,7 +265,7 @@ func (l *Logger) openExistingOrNew(writeLen int) error {
l.mill()
filename := l.filename()
info, err := os_Stat(filename)
info, err := osStat(filename)
if os.IsNotExist(err) {
return l.openNew()
}
@@ -376,7 +376,7 @@ func (l *Logger) millRunOnce() error {
// millRun runs in a goroutine to manage post-rotation compression and removal
// of old log files.
func (l *Logger) millRun() {
for _ = range l.millCh {
for range l.millCh {
// what am I going to do, log this?
_ = l.millRunOnce()
}
@@ -472,7 +472,7 @@ func compressLogFile(src, dst string) (err error) {
}
defer f.Close()
fi, err := os_Stat(src)
fi, err := osStat(src)
if err != nil {
return fmt.Errorf("failed to stat log file: %v", err)
}