refactor: log uixt action

This commit is contained in:
lilong.129
2024-12-08 13:53:27 +08:00
parent b3db26f6f9
commit 9cfbea1907
3 changed files with 11 additions and 16 deletions

View File

@@ -1 +1 @@
v5.0.0+2412081242
v5.0.0+2412081353

View File

@@ -7,6 +7,7 @@ import (
"time"
"github.com/pkg/errors"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"github.com/httprunner/httprunner/v4/hrp/internal/builtin"
@@ -565,26 +566,19 @@ func (dExt *DriverExt) GenAbsScope(x1, y1, x2, y2 float64) AbsScope {
}
func (dExt *DriverExt) DoAction(action MobileAction) (err error) {
log.Info().
Str("method", string(action.Method)).
Interface("params", action.Params).
Msg("uixt action start")
actionStartTime := time.Now()
defer func() {
var logger *zerolog.Event
if err != nil {
log.Error().Err(err).
Str("method", string(action.Method)).
Interface("params", action.Params).
Int64("elapsed(ms)", time.Since(actionStartTime).Milliseconds()).
Msg("uixt action end")
logger = log.Error().Bool("success", false).Err(err)
} else {
log.Info().
Str("method", string(action.Method)).
Interface("params", action.Params).
Int64("elapsed(ms)", time.Since(actionStartTime).Milliseconds()).
Msg("uixt action end")
logger = log.Debug().Bool("success", true)
}
logger = logger.
Str("method", string(action.Method)).
Interface("params", action.Params).
Int64("elapsed(ms)", time.Since(actionStartTime).Milliseconds())
logger.Msg("exec uixt action")
}()
switch action.Method {

View File

@@ -189,6 +189,7 @@ func (s *veDEMImageService) GetImage(imageBuf *bytes.Buffer, options ...ActionOp
Int("code", imageResponse.Code).
Str("message", imageResponse.Message).
Msg("request veDEM OCR service failed")
return nil, errors.New(imageResponse.Message)
}
imageResult = &imageResponse.Result