change: replace log duration in miliseconds

This commit is contained in:
lilong.129
2023-08-14 21:36:33 +08:00
parent aa5692ba0b
commit 521462f362
4 changed files with 9 additions and 9 deletions

View File

@@ -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")
}()

View File

@@ -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")
}()

View File

@@ -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
}

View File

@@ -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