From 2e6c9079870eb30f6eab0f567cfb1302bebeec45 Mon Sep 17 00:00:00 2001 From: Michael Mayer Date: Sat, 2 Oct 2021 16:46:53 +0200 Subject: [PATCH] Logs: Improve purge log messages --- internal/photoprism/cleanup.go | 2 +- internal/photoprism/faces_match.go | 8 +++++--- internal/photoprism/purge.go | 2 +- internal/query/purge.go | 4 ++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/internal/photoprism/cleanup.go b/internal/photoprism/cleanup.go index ede509490..8d4825758 100644 --- a/internal/photoprism/cleanup.go +++ b/internal/photoprism/cleanup.go @@ -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) } } diff --git a/internal/photoprism/faces_match.go b/internal/photoprism/faces_match.go index ebe3a2abb..349af4133 100644 --- a/internal/photoprism/faces_match.go +++ b/internal/photoprism/faces_match.go @@ -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 diff --git a/internal/photoprism/purge.go b/internal/photoprism/purge.go index 1c8bffd86..7e0e0ebc7 100644 --- a/internal/photoprism/purge.go +++ b/internal/photoprism/purge.go @@ -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) } } diff --git a/internal/query/purge.go b/internal/query/purge.go index 6fbadd288..ff4859388 100644 --- a/internal/query/purge.go +++ b/internal/query/purge.go @@ -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.