2
2
mirror of https://github.com/octoleo/restic.git synced 2024-06-19 09:12:22 +00:00

ui: Simplify ReportTotal methods

This commit is contained in:
Michael Eischer 2021-08-18 01:25:34 +02:00
parent 448419990c
commit 80cbaf6d38
2 changed files with 12 additions and 17 deletions

View File

@ -151,12 +151,10 @@ func (b *Backup) CompleteItem(messageType, item string, previous, current *resti
// ReportTotal sets the total stats up to now // ReportTotal sets the total stats up to now
func (b *Backup) ReportTotal(item string, start time.Time, s archiver.ScanStats) { func (b *Backup) ReportTotal(item string, start time.Time, s archiver.ScanStats) {
if item == "" { b.V("scan finished in %.3fs: %v files, %s",
b.V("scan finished in %.3fs: %v files, %s", time.Since(start).Seconds(),
time.Since(start).Seconds(), s.Files, formatBytes(s.Bytes),
s.Files, formatBytes(s.Bytes), )
)
}
} }
// Reset status // Reset status

View File

@ -157,17 +157,14 @@ func (b *Backup) CompleteItem(messageType, item string, previous, current *resti
// ReportTotal sets the total stats up to now // ReportTotal sets the total stats up to now
func (b *Backup) ReportTotal(item string, start time.Time, s archiver.ScanStats) { func (b *Backup) ReportTotal(item string, start time.Time, s archiver.ScanStats) {
if item == "" { if b.v >= 2 {
if b.v >= 2 { b.print(verboseUpdate{
b.print(verboseUpdate{ MessageType: "status",
MessageType: "status", Action: "scan_finished",
Action: "scan_finished", Duration: time.Since(start).Seconds(),
Duration: time.Since(start).Seconds(), DataSize: s.Bytes,
DataSize: s.Bytes, TotalFiles: s.Files,
TotalFiles: s.Files, })
})
}
return
} }
} }