Skip to content

Commit

Permalink
Logs: More consistent log format for commands
Browse files Browse the repository at this point in the history
  • Loading branch information
lastzero committed Oct 2, 2021
1 parent de737a6 commit bf01532
Show file tree
Hide file tree
Showing 14 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion internal/commands/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ func backupAction(ctx *cli.Context) error {

elapsed := time.Since(start)

log.Infof("backup completed [%s]", elapsed)
log.Infof("backup completed in %s", elapsed)

conf.Shutdown()

Expand Down
2 changes: 1 addition & 1 deletion internal/commands/cleanup.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func cleanUpAction(ctx *cli.Context) error {
if thumbs, orphans, err := w.Start(opt); err != nil {
return err
} else {
log.Infof("cleanup: removed %s and %s [%s]", english.Plural(orphans, "index entry", "index entries"), english.Plural(thumbs, "thumbnail", "thumbnails"), time.Since(start))
log.Infof("removed %s and %s in %s", english.Plural(orphans, "index entry", "index entries"), english.Plural(thumbs, "thumbnail", "thumbnails"), time.Since(start))
}

conf.Shutdown()
Expand Down
2 changes: 1 addition & 1 deletion internal/commands/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func convertAction(ctx *cli.Context) error {

elapsed := time.Since(start)

log.Infof("converting completed [%s]", elapsed)
log.Infof("converting completed in %s", elapsed)

return nil
}
4 changes: 3 additions & 1 deletion internal/commands/copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ func copyAction(ctx *cli.Context) error {

elapsed := time.Since(start)

log.Infof("import completed [%s]", elapsed)
log.Infof("import completed in %s", elapsed)

conf.Shutdown()

return nil
}
14 changes: 7 additions & 7 deletions internal/commands/faces.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func facesStatsAction(ctx *cli.Context) error {
} else {
elapsed := time.Since(start)

log.Infof("completed [%s]", elapsed)
log.Infof("completed in %s", elapsed)
}

conf.Shutdown()
Expand Down Expand Up @@ -130,7 +130,7 @@ func facesAuditAction(ctx *cli.Context) error {
} else {
elapsed := time.Since(start)

log.Infof("completed [%s]", elapsed)
log.Infof("completed in %s", elapsed)
}

conf.Shutdown()
Expand Down Expand Up @@ -174,7 +174,7 @@ func facesResetAction(ctx *cli.Context) error {
} else {
elapsed := time.Since(start)

log.Infof("completed [%s]", elapsed)
log.Infof("completed in %s", elapsed)
}

conf.Shutdown()
Expand Down Expand Up @@ -212,7 +212,7 @@ func facesResetAllAction(ctx *cli.Context) error {
} else {
elapsed := time.Since(start)

log.Infof("completed [%s]", elapsed)
log.Infof("completed in %s", elapsed)
}

conf.Shutdown()
Expand Down Expand Up @@ -278,7 +278,7 @@ func facesIndexAction(ctx *cli.Context) error {

elapsed := time.Since(start)

log.Infof("indexed %d files [%s]", len(indexed), elapsed)
log.Infof("indexed %s in %s", english.Plural(len(indexed), "file", "files"), elapsed)

conf.Shutdown()

Expand Down Expand Up @@ -312,7 +312,7 @@ func facesUpdateAction(ctx *cli.Context) error {
} else {
elapsed := time.Since(start)

log.Infof("completed [%s]", elapsed)
log.Infof("completed in %s", elapsed)
}

conf.Shutdown()
Expand Down Expand Up @@ -343,7 +343,7 @@ func facesOptimizeAction(ctx *cli.Context) error {
} else {
elapsed := time.Since(start)

log.Infof("%d face clusters merged [%s]", res.Merged, elapsed)
log.Infof("%s merged in %s", english.Plural(res.Merged, "face cluster", "face clusters"), elapsed)
}

conf.Shutdown()
Expand Down
4 changes: 3 additions & 1 deletion internal/commands/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ func importAction(ctx *cli.Context) error {

elapsed := time.Since(start)

log.Infof("import completed [%s]", elapsed)
log.Infof("import completed in %s", elapsed)

conf.Shutdown()

return nil
}
2 changes: 1 addition & 1 deletion internal/commands/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func indexAction(ctx *cli.Context) error {

elapsed := time.Since(start)

log.Infof("indexed %d files [%s]", len(indexed), elapsed)
log.Infof("indexed %s in %s", english.Plural(len(indexed), "file", "files"), elapsed)

conf.Shutdown()

Expand Down
2 changes: 1 addition & 1 deletion internal/commands/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func migrateAction(ctx *cli.Context) error {

elapsed := time.Since(start)

log.Infof("database migration completed [%s]", elapsed)
log.Infof("database migration completed in %s", elapsed)

conf.Shutdown()

Expand Down
2 changes: 1 addition & 1 deletion internal/commands/moments.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func momentsAction(ctx *cli.Context) error {
} else {
elapsed := time.Since(start)

log.Infof("completed [%s]", elapsed)
log.Infof("completed in %s", elapsed)
}

conf.Shutdown()
Expand Down
2 changes: 1 addition & 1 deletion internal/commands/optimize.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func optimizeAction(ctx *cli.Context) error {
} else {
elapsed := time.Since(start)

log.Infof("completed [%s]", elapsed)
log.Infof("completed in %s", elapsed)
}

conf.Shutdown()
Expand Down
4 changes: 1 addition & 3 deletions internal/commands/purge.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@ func purgeAction(ctx *cli.Context) error {
if files, photos, err := w.Start(opt); err != nil {
return err
} else {
elapsed := time.Since(start)

log.Infof("purge: removed %s and %s [%s]", english.Plural(len(files), "file", "files"), english.Plural(len(photos), "photo", "photos"), elapsed)
log.Infof("purged %s and %s in %s", english.Plural(len(files), "file", "files"), english.Plural(len(photos), "photo", "photos"), time.Since(start))
}

conf.Shutdown()
Expand Down
4 changes: 1 addition & 3 deletions internal/commands/resample.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ func resampleAction(ctx *cli.Context) error {
return err
}

elapsed := time.Since(start)

log.Infof("thumbnails created [%s]", elapsed)
log.Infof("thumbnails created in %s", time.Since(start))

return nil
}
2 changes: 1 addition & 1 deletion internal/commands/reset.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func resetAction(ctx *cli.Context) error {
entity.Admin.InitPassword(conf.AdminPassword())
}

log.Infof("database reset completed [%s]", time.Since(start))
log.Infof("database reset completed in %s", time.Since(start))
} else {
log.Infof("keeping index database")
}
Expand Down
2 changes: 1 addition & 1 deletion internal/commands/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ func restoreAction(ctx *cli.Context) error {

elapsed := time.Since(start)

log.Infof("backup restored [%s]", elapsed)
log.Infof("backup restored in %s", elapsed)

conf.Shutdown()

Expand Down

0 comments on commit bf01532

Please sign in to comment.