[swd-e2e-tests] Switch to using logger
This switches from the "log" library to "logger" in order to annotate each
line with the estimated target monotonic time.
Test: no behavior change
Change-Id: Iaef1953652e5e8190446992525133f567f2633fc
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/404656
Commit-Queue: Erick Tryzelaar <etryzelaar@google.com>
Reviewed-by: Alex Legg <alexlegg@google.com>
Testability-Review: Alex Legg <alexlegg@google.com>
diff --git a/src/sys/pkg/testing/host-target-testing/updater/updater.go b/src/sys/pkg/testing/host-target-testing/updater/updater.go
index f8a36af..657cbf8 100644
--- a/src/sys/pkg/testing/host-target-testing/updater/updater.go
+++ b/src/sys/pkg/testing/host-target-testing/updater/updater.go
@@ -9,11 +9,11 @@
"errors"
"fmt"
"io"
- "log"
"os"
"time"
"go.fuchsia.dev/fuchsia/src/sys/pkg/testing/host-target-testing/packages"
+ "go.fuchsia.dev/fuchsia/tools/lib/logger"
"golang.org/x/crypto/ssh"
)
@@ -43,7 +43,8 @@
}
func (u *SystemUpdateChecker) Update(ctx context.Context, c client) error {
- log.Printf("Triggering OTA")
+ logger.Infof(ctx, "Triggering OTA")
+
startTime := time.Now()
basePackages, err := c.ReadBasePackages(ctx)
if err != nil {
@@ -81,7 +82,9 @@
if err != nil {
return err
}
- log.Printf("OTA completed in %s", time.Now().Sub(startTime))
+
+ logger.Infof(ctx, "OTA completed in %s", time.Now().Sub(startTime))
+
return nil
}
@@ -96,7 +99,8 @@
}
func (u *SystemUpdater) Update(ctx context.Context, c client) error {
- log.Printf("Downloading OTA")
+ logger.Infof(ctx, "Downloading OTA")
+
startTime := time.Now()
server, err := c.ServePackageRepository(ctx, u.repo, "download-ota", true)
if err != nil {
@@ -104,7 +108,8 @@
}
defer server.Shutdown(ctx)
- log.Printf("Downloading system OTA")
+ logger.Infof(ctx, "Downloading system OTA")
+
cmd := []string{
"update",
"force-install",
@@ -114,6 +119,8 @@
if err := c.Run(ctx, cmd, os.Stdout, os.Stderr); err != nil {
return fmt.Errorf("failed to run system updater: %w", err)
}
- log.Printf("OTA successfully downloaded in %s", time.Now().Sub(startTime))
+
+ logger.Infof(ctx, "OTA successfully downloaded in %s", time.Now().Sub(startTime))
+
return nil
}