Index: Don't expose full directory names in logs #391

Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
Michael Mayer 2020-07-21 15:01:46 +02:00
parent 7d00e68d92
commit fc9442b6a3
4 changed files with 8 additions and 4 deletions

View file

@ -10,6 +10,7 @@ import (
"path/filepath"
"runtime/debug"
"strconv"
"strings"
"sync"
"github.com/karrick/godirwalk"
@ -66,7 +67,7 @@ func (c *Convert) Start(path string) error {
err := godirwalk.Walk(path, &godirwalk.Options{
ErrorCallback: func(fileName string, err error) godirwalk.ErrorAction {
log.Errorf("convert: %s", err)
log.Errorf("convert: %s", strings.Replace(err.Error(), path, "", 1))
return godirwalk.SkipNode
},
Callback: func(fileName string, info *godirwalk.Dirent) error {

View file

@ -8,6 +8,7 @@ import (
"runtime"
"runtime/debug"
"sort"
"strings"
"sync"
"github.com/karrick/godirwalk"
@ -98,7 +99,7 @@ func (imp *Import) Start(opt ImportOptions) fs.Done {
err := godirwalk.Walk(importPath, &godirwalk.Options{
ErrorCallback: func(fileName string, err error) godirwalk.ErrorAction {
log.Errorf("import: %s", err)
log.Errorf("import: %s", strings.Replace(err.Error(), importPath, "", 1))
return godirwalk.SkipNode
},
Callback: func(fileName string, info *godirwalk.Dirent) error {

View file

@ -6,6 +6,7 @@ import (
"path/filepath"
"runtime"
"runtime/debug"
"strings"
"sync"
"github.com/karrick/godirwalk"
@ -114,7 +115,7 @@ func (ind *Index) Start(opt IndexOptions) fs.Done {
err := godirwalk.Walk(optionsPath, &godirwalk.Options{
ErrorCallback: func(fileName string, err error) godirwalk.ErrorAction {
log.Errorf("index: %s", err)
log.Errorf("index: %s", strings.Replace(err.Error(), originalsPath, "", 1))
return godirwalk.SkipNode
},
Callback: func(fileName string, info *godirwalk.Dirent) error {

View file

@ -5,6 +5,7 @@ import (
"fmt"
"path/filepath"
"runtime/debug"
"strings"
"sync"
"github.com/karrick/godirwalk"
@ -68,7 +69,7 @@ func (rs *Resample) Start(force bool) (err error) {
err = godirwalk.Walk(originalsPath, &godirwalk.Options{
ErrorCallback: func(fileName string, err error) godirwalk.ErrorAction {
log.Errorf("resample: %s", err)
log.Errorf("resample: %s", strings.Replace(err.Error(), originalsPath, "", 1))
return godirwalk.SkipNode
},
Callback: func(fileName string, info *godirwalk.Dirent) error {