Add support for calculating the estimate time remaining (#71)

This commit is contained in:
Arturo Filastò
2019-11-14 12:01:40 +01:00
committed by GitHub
parent 0c6862bb87
commit bc1314ca61
3 changed files with 20 additions and 12 deletions
+4 -2
View File
@@ -109,9 +109,11 @@ func (h *Handler) TypedLog(t string, e *log.Entry) error {
return nil
case "progress":
perc := e.Fields.Get("percentage").(float64) * 100
s := fmt.Sprintf(" %s %-25s",
eta := e.Fields.Get("eta").(float64)
s := fmt.Sprintf(" %s %-25s (%ss left)",
bold.Sprintf("%.2f%%", perc),
e.Message)
e.Message,
bold.Sprintf("%.2f", eta))
fmt.Fprint(h.Writer, s)
fmt.Fprintln(h.Writer)
return nil