From 521462f362af79feeecd3de96f4b94adc5971f8a Mon Sep 17 00:00:00 2001 From: "lilong.129" Date: Mon, 14 Aug 2023 21:36:33 +0800 Subject: [PATCH] change: replace log duration in miliseconds --- hrp/pkg/gadb/device.go | 4 ++-- hrp/pkg/uixt/action.go | 2 +- hrp/pkg/uixt/service_vedem.go | 6 +++--- hrp/runner.go | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/hrp/pkg/gadb/device.go b/hrp/pkg/gadb/device.go index 9d497fcf..8b9705b6 100644 --- a/hrp/pkg/gadb/device.go +++ b/hrp/pkg/gadb/device.go @@ -273,7 +273,7 @@ func (d *Device) RunShellCommandWithBytes(cmd string, args ...string) ([]byte, e // log elapsed seconds for shell execution log.Debug().Str("cmd", fmt.Sprintf("adb -s %s shell %s", d.serial, cmd)). - Float64("elapsed(s)", time.Since(startTime).Seconds()). + Int64("elapsed(ms)", time.Since(startTime).Milliseconds()). Msg("run adb shell") }() @@ -295,7 +295,7 @@ func (d *Device) RunShellCommandV2WithBytes(cmd string, args ...string) ([]byte, // log elapsed seconds for shell execution log.Debug().Str("cmd", fmt.Sprintf("adb -s %s shell %s", d.serial, cmd)). - Float64("elapsed(s)", time.Since(startTime).Seconds()). + Int64("elapsed(ms)", time.Since(startTime).Milliseconds()). Msg("run adb shell in v2") }() diff --git a/hrp/pkg/uixt/action.go b/hrp/pkg/uixt/action.go index 0d8b593f..7fbb960b 100644 --- a/hrp/pkg/uixt/action.go +++ b/hrp/pkg/uixt/action.go @@ -396,7 +396,7 @@ func (dExt *DriverExt) DoAction(action MobileAction) error { log.Debug(). Str("method", string(action.Method)). Interface("params", action.Params). - Float64("elapsed(s)", time.Since(actionStartTime).Seconds()). + Int64("elapsed(ms)", time.Since(actionStartTime).Milliseconds()). Msg("uixt action end") }() diff --git a/hrp/pkg/uixt/service_vedem.go b/hrp/pkg/uixt/service_vedem.go index 8d71bedf..a5d4c37e 100644 --- a/hrp/pkg/uixt/service_vedem.go +++ b/hrp/pkg/uixt/service_vedem.go @@ -256,7 +256,7 @@ func (s *veDEMImageService) GetImage(imageBuf *bytes.Buffer, options ...interfac log.Debug(). Str("X-TT-LOGID", logID). Int("image_bytes", size). - Float64("elapsed(s)", elapsed.Seconds()). + Int64("elapsed(ms)", elapsed.Milliseconds()). Msg("request OCR service success") break } @@ -379,8 +379,8 @@ func (dExt *DriverExt) GetScreenResult() (screenResult *ScreenResult, err error) dExt.cacheStepData.screenResults[imagePath] = screenResult log.Debug(). - Int64("ScreenshotTakeElapsed", screenResult.ScreenshotTakeElapsed). - Int64("ScreenshotCVElapsed", screenResult.ScreenshotCVElapsed). + Int64("screenshot_take_elapsed(ms)", screenResult.ScreenshotTakeElapsed). + Int64("screenshot_cv_elapsed(ms)", screenResult.ScreenshotCVElapsed). Msg("get screenshot result success") return screenResult, nil } diff --git a/hrp/runner.go b/hrp/runner.go index 9f8af0de..57ff3e7d 100644 --- a/hrp/runner.go +++ b/hrp/runner.go @@ -586,12 +586,12 @@ func (r *SessionRunner) Start(givenVars map[string]interface{}) error { r.sessionVariables[k] = v } - stepElapsed := time.Since(stepStartTime).Seconds() + stepElapsed := time.Since(stepStartTime).Milliseconds() if err == nil { log.Info().Str("step", stepName). Str("type", stepType). Bool("success", true). - Float64("elapsed(s)", stepElapsed). + Int64("elapsed(ms)", stepElapsed). Interface("exportVars", stepResult.ExportVars). Msg("run step end") continue @@ -601,7 +601,7 @@ func (r *SessionRunner) Start(givenVars map[string]interface{}) error { log.Error().Err(err).Str("step", stepName). Str("type", stepType). Bool("success", false). - Float64("elapsed(s)", stepElapsed). + Int64("elapsed(ms)", stepElapsed). Msg("run step end") // interrupted or timeout, abort running