engine: resources: Improve output of log messages
I don't remember ever having this display a pointer address, but it is now, so let's make this cleaner.
This commit is contained in:
@@ -40,6 +40,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
@@ -780,7 +781,7 @@ func (obj *FileRes) syncCheckApply(ctx context.Context, apply bool, src, dst str
|
|||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
smartSrc = mapPaths(srcFiles)
|
smartSrc = mapPaths(srcFiles)
|
||||||
obj.init.Logf("syncCheckApply: srcFiles: %v", srcFiles)
|
obj.init.Logf("syncCheckApply: srcFiles: %v", printFiles(smartSrc))
|
||||||
}
|
}
|
||||||
|
|
||||||
dstFiles, err := ReadDir(dst)
|
dstFiles, err := ReadDir(dst)
|
||||||
@@ -788,7 +789,7 @@ func (obj *FileRes) syncCheckApply(ctx context.Context, apply bool, src, dst str
|
|||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
smartDst := mapPaths(dstFiles)
|
smartDst := mapPaths(dstFiles)
|
||||||
obj.init.Logf("syncCheckApply: dstFiles: %v", dstFiles)
|
obj.init.Logf("syncCheckApply: dstFiles: %v", printFiles(smartDst))
|
||||||
|
|
||||||
for relPath, fileInfo := range smartSrc {
|
for relPath, fileInfo := range smartSrc {
|
||||||
absSrc := fileInfo.AbsPath // absolute path
|
absSrc := fileInfo.AbsPath // absolute path
|
||||||
@@ -1717,3 +1718,20 @@ func mapPaths(fileInfos []FileInfo) map[string]FileInfo {
|
|||||||
}
|
}
|
||||||
return paths
|
return paths
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// printFiles is a pretty print function to make log messages less ugly.
|
||||||
|
func printFiles(fileInfos map[string]FileInfo) string {
|
||||||
|
s := ""
|
||||||
|
keys := []string{}
|
||||||
|
for k := range fileInfos {
|
||||||
|
keys = append(keys, k)
|
||||||
|
}
|
||||||
|
sort.Strings(keys)
|
||||||
|
for i, k := range keys {
|
||||||
|
s += fileInfos[k].RelPath
|
||||||
|
if i < len(keys)-1 {
|
||||||
|
s += ", "
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user