diff --git a/cmd/dump/dump.go b/cmd/dump/dump.go index 68d206b6..436ca791 100644 --- a/cmd/dump/dump.go +++ b/cmd/dump/dump.go @@ -143,6 +143,8 @@ func run(cmd *cobra.Command, args []string) (err error) { fmt.Println("::set-output name=filename::" + conf.Filename) } + var startTime = time.Now() + bar := progressbar.New(-1, "downloading") plogger := progressbar.NewBarSafeLogger(os.Stderr, bar) log.SetOutput(plogger) @@ -216,7 +218,10 @@ func run(cmd *cobra.Command, args []string) (err error) { } } - log.WithField("file", conf.Filename).Info("dump complete") + log.WithFields(log.Fields{ + "file": conf.Filename, + "in": time.Since(startTime).Truncate(10 * time.Millisecond), + }).Info("dump complete") return nil } diff --git a/cmd/restore/restore.go b/cmd/restore/restore.go index 31744726..d924c010 100644 --- a/cmd/restore/restore.go +++ b/cmd/restore/restore.go @@ -18,6 +18,7 @@ import ( "k8s.io/kubectl/pkg/util/term" "os" "strings" + "time" ) var Command = &cobra.Command{ @@ -126,6 +127,8 @@ func run(cmd *cobra.Command, args []string) (err error) { } } + startTime := time.Now() + bar := progressbar.New(-1, "uploading") errLog := progressbar.NewBarSafeLogger(os.Stderr, bar) outLog := progressbar.NewBarSafeLogger(os.Stdout, bar) @@ -193,7 +196,10 @@ func run(cmd *cobra.Command, args []string) (err error) { return err } - log.WithField("file", conf.Filename).Info("restore complete") + log.WithFields(log.Fields{ + "file": conf.Filename, + "in": time.Since(startTime).Truncate(10 * time.Millisecond), + }).Info("restore complete") return nil }