use our logger in autofile/group

This commit is contained in:
Anton Kaliaev
2018-11-06 13:12:12 +01:00
parent 46d32af055
commit d178ea9eaf
3 changed files with 23 additions and 5 deletions

View File

@@ -5,7 +5,6 @@ import (
"errors"
"fmt"
"io"
"log"
"os"
"path"
"path/filepath"
@@ -253,18 +252,18 @@ func (g *Group) checkTotalSizeLimit() {
}
if index == gInfo.MaxIndex {
// Special degenerate case, just do nothing.
log.Println("WARNING: Group's head " + g.Head.Path + "may grow without bound")
g.Logger.Info("Group's head may grow without bound", "head", g.Head.Path)
return
}
pathToRemove := filePathForIndex(g.Head.Path, index, gInfo.MaxIndex)
fileInfo, err := os.Stat(pathToRemove)
if err != nil {
log.Println("WARNING: Failed to fetch info for file @" + pathToRemove)
g.Logger.Error("Failed to fetch info for file", "file", pathToRemove)
continue
}
err = os.Remove(pathToRemove)
if err != nil {
log.Println(err)
g.Logger.Error("Failed to remove path", "path", pathToRemove)
return
}
totalSize -= fileInfo.Size()