Logs: Improve purge log messages

This commit is contained in:
Michael Mayer 2021-10-02 16:46:53 +02:00
parent bf0153267d
commit 2e6c907987
4 changed files with 9 additions and 7 deletions

View file

@ -144,7 +144,7 @@ func (w *CleanUp) Start(opt CleanUpOptions) (thumbs int, orphans int, err error)
}
} else {
if err := query.PurgeOrphans(); err != nil {
log.Errorf("index: %s (remove orphans)", err)
log.Errorf("index: %s (purge orphans)", err)
}
}

View file

@ -4,6 +4,8 @@ import (
"fmt"
"time"
"github.com/dustin/go-humanize/english"
"github.com/photoprism/photoprism/internal/entity"
"github.com/photoprism/photoprism/internal/query"
)
@ -34,9 +36,9 @@ func (w *Faces) Match(opt FacesOptions) (result FacesMatchResult, err error) {
if opt.Force {
log.Infof("faces: updating all markers")
} else if unmatchedMarkers = query.CountUnmatchedFaceMarkers(); unmatchedMarkers > 0 {
log.Infof("faces: %d unmatched markers", unmatchedMarkers)
log.Infof("faces: found %s", english.Plural(unmatchedMarkers, "unmatched marker", "unmatched markers"))
} else {
log.Debugf("faces: no unmatched markers")
log.Debugf("faces: found no unmatched markers")
}
matchedAt := entity.TimePointer()
@ -174,7 +176,7 @@ func (w *Faces) MatchFaces(faces entity.Faces, force bool, matchedBefore *time.T
}
}
log.Debugf("faces: matched %d markers", matched)
log.Debugf("faces: matched %s", english.Plural(matched, "marker", "markers"))
if matched > max {
break

View file

@ -261,7 +261,7 @@ func (w *Purge) Start(opt PurgeOptions) (purgedFiles map[string]bool, purgedPhot
}
} else {
if err := query.PurgeOrphans(); err != nil {
log.Errorf("index: %s (remove orphans)", err)
log.Errorf("index: %s (purge orphans)", err)
}
}

View file

@ -13,9 +13,9 @@ func PurgeOrphans() error {
if count, err := PurgeOrphanFiles(); err != nil {
return err
} else if count > 0 {
log.Warnf("purge: removed %d orphan files [%s]", count, time.Since(start))
log.Warnf("index: removed %d orphan files [%s]", count, time.Since(start))
} else {
log.Infof("purge: found no orphan files [%s]", time.Since(start))
log.Infof("index: found no orphan files [%s]", time.Since(start))
}
// Remove duplicates without an original file.