Index: Improve log messages #2257
This commit is contained in:
parent
79d60a665f
commit
e264489dfb
6 changed files with 12 additions and 14 deletions
|
@ -875,7 +875,7 @@ func (m *Photo) SetPrimary(fileUID string) (err error) {
|
|||
Pluck("file_uid", &files).Error; err != nil {
|
||||
return err
|
||||
} else if len(files) == 0 {
|
||||
return fmt.Errorf("found no valid jpeg for %s", m.PhotoUID)
|
||||
return fmt.Errorf("found no jpeg for photo uid %s", clean.Log(m.PhotoUID))
|
||||
} else {
|
||||
fileUID = files[0]
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ import (
|
|||
"fmt"
|
||||
"path/filepath"
|
||||
"runtime/debug"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/karrick/godirwalk"
|
||||
|
@ -76,7 +75,6 @@ func (c *Convert) Start(path string, force bool) (err error) {
|
|||
|
||||
err = godirwalk.Walk(path, &godirwalk.Options{
|
||||
ErrorCallback: func(fileName string, err error) godirwalk.ErrorAction {
|
||||
log.Errorf("convert: %s", strings.Replace(err.Error(), path, "", 1))
|
||||
return godirwalk.SkipNode
|
||||
},
|
||||
Callback: func(fileName string, info *godirwalk.Dirent) error {
|
||||
|
@ -87,7 +85,7 @@ func (c *Convert) Start(path string, force bool) (err error) {
|
|||
}()
|
||||
|
||||
if mutex.MainWorker.Canceled() {
|
||||
return errors.New("convert: canceled")
|
||||
return errors.New("canceled")
|
||||
}
|
||||
|
||||
isDir := info.IsDir()
|
||||
|
|
|
@ -8,7 +8,6 @@ import (
|
|||
"runtime"
|
||||
"runtime/debug"
|
||||
"sort"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/photoprism/photoprism/pkg/media"
|
||||
|
@ -118,7 +117,6 @@ 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", strings.Replace(err.Error(), importPath, "", 1))
|
||||
return godirwalk.SkipNode
|
||||
},
|
||||
Callback: func(fileName string, info *godirwalk.Dirent) error {
|
||||
|
@ -129,7 +127,7 @@ func (imp *Import) Start(opt ImportOptions) fs.Done {
|
|||
}()
|
||||
|
||||
if mutex.MainWorker.Canceled() {
|
||||
return errors.New("import canceled")
|
||||
return errors.New("canceled")
|
||||
}
|
||||
|
||||
isDir := info.IsDir()
|
||||
|
|
|
@ -6,7 +6,6 @@ import (
|
|||
"path/filepath"
|
||||
"runtime"
|
||||
"runtime/debug"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/photoprism/photoprism/pkg/media"
|
||||
|
@ -141,12 +140,17 @@ func (ind *Index) Start(o IndexOptions) fs.Done {
|
|||
|
||||
err := godirwalk.Walk(optionsPath, &godirwalk.Options{
|
||||
ErrorCallback: func(fileName string, err error) godirwalk.ErrorAction {
|
||||
log.Errorf("index: %s", strings.Replace(err.Error(), originalsPath, "", 1))
|
||||
return godirwalk.SkipNode
|
||||
},
|
||||
Callback: func(fileName string, info *godirwalk.Dirent) error {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
log.Errorf("index: %s (panic)\nstack: %s", r, debug.Stack())
|
||||
}
|
||||
}()
|
||||
|
||||
if mutex.MainWorker.Canceled() {
|
||||
return errors.New("indexing canceled")
|
||||
return errors.New("canceled")
|
||||
}
|
||||
|
||||
isDir := info.IsDir()
|
||||
|
|
|
@ -5,7 +5,6 @@ import (
|
|||
"fmt"
|
||||
"path/filepath"
|
||||
"runtime/debug"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/karrick/godirwalk"
|
||||
|
@ -69,7 +68,6 @@ func (w *Resample) Start(force bool) (err error) {
|
|||
|
||||
err = godirwalk.Walk(originalsPath, &godirwalk.Options{
|
||||
ErrorCallback: func(fileName string, err error) godirwalk.ErrorAction {
|
||||
log.Errorf("resample: %s", strings.Replace(err.Error(), originalsPath, "", 1))
|
||||
return godirwalk.SkipNode
|
||||
},
|
||||
Callback: func(fileName string, info *godirwalk.Dirent) error {
|
||||
|
@ -80,7 +78,7 @@ func (w *Resample) Start(force bool) (err error) {
|
|||
}()
|
||||
|
||||
if mutex.MainWorker.Canceled() {
|
||||
return errors.New("resample: canceled")
|
||||
return errors.New("canceled")
|
||||
}
|
||||
|
||||
isDir := info.IsDir()
|
||||
|
|
|
@ -151,7 +151,7 @@ func FixPrimaries() error {
|
|||
log.Debugf("index: searching primary file for %s", p.PhotoUID)
|
||||
|
||||
if err := p.SetPrimary(""); err != nil {
|
||||
log.Infof("index: %s (set primary)", err)
|
||||
log.Infof("index: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue