diff --git a/pkg/fileutil/fileutil.go b/pkg/fileutil/fileutil.go index 48e774bb1..acb7a6b81 100644 --- a/pkg/fileutil/fileutil.go +++ b/pkg/fileutil/fileutil.go @@ -19,12 +19,18 @@ import ( "os" "path" "sort" + + "github.com/coreos/etcd/Godeps/_workspace/src/github.com/coreos/pkg/capnslog" ) const ( privateFileMode = 0600 ) +var ( + plog = capnslog.NewPackageLogger("github.com/coreos/etcd/pkg", "fileutil") +) + // IsDirWriteable checks if dir is writable by writing and removing a file // to dir. It returns nil if dir is writable. func IsDirWriteable(dir string) error { diff --git a/pkg/fileutil/purge.go b/pkg/fileutil/purge.go index a7e12f057..9b2c2984e 100644 --- a/pkg/fileutil/purge.go +++ b/pkg/fileutil/purge.go @@ -15,7 +15,6 @@ package fileutil import ( - "log" "os" "path" "sort" @@ -57,13 +56,13 @@ func PurgeFile(dirname string, suffix string, max uint, interval time.Duration, } err = l.Unlock() if err != nil { - log.Printf("filePurge: unlock %s error %v", l.Name(), err) + plog.Errorf("error unlocking %s when purging file (%v)", l.Name(), err) } err = l.Destroy() if err != nil { - log.Printf("filePurge: destroy lock %s error %v", l.Name(), err) + plog.Errorf("error destroying lock %s when purging file (%v)", l.Name(), err) } - log.Printf("filePurge: successfully removed file %s", f) + plog.Infof("purged file %s successfully", f) newfnames = newfnames[1:] } select {