mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-05 07:26:55 +08:00
refactor: log uixt action
This commit is contained in:
@@ -1 +1 @@
|
|||||||
v5.0.0+2412081242
|
v5.0.0+2412081353
|
||||||
|
|||||||
+9
-15
@@ -7,6 +7,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
"github.com/rs/zerolog"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
|
|
||||||
"github.com/httprunner/httprunner/v4/hrp/internal/builtin"
|
"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) {
|
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()
|
actionStartTime := time.Now()
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
|
var logger *zerolog.Event
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error().Err(err).
|
logger = log.Error().Bool("success", false).Err(err)
|
||||||
Str("method", string(action.Method)).
|
|
||||||
Interface("params", action.Params).
|
|
||||||
Int64("elapsed(ms)", time.Since(actionStartTime).Milliseconds()).
|
|
||||||
Msg("uixt action end")
|
|
||||||
} else {
|
} else {
|
||||||
log.Info().
|
logger = log.Debug().Bool("success", true)
|
||||||
Str("method", string(action.Method)).
|
|
||||||
Interface("params", action.Params).
|
|
||||||
Int64("elapsed(ms)", time.Since(actionStartTime).Milliseconds()).
|
|
||||||
Msg("uixt action end")
|
|
||||||
}
|
}
|
||||||
|
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 {
|
switch action.Method {
|
||||||
|
|||||||
@@ -189,6 +189,7 @@ func (s *veDEMImageService) GetImage(imageBuf *bytes.Buffer, options ...ActionOp
|
|||||||
Int("code", imageResponse.Code).
|
Int("code", imageResponse.Code).
|
||||||
Str("message", imageResponse.Message).
|
Str("message", imageResponse.Message).
|
||||||
Msg("request veDEM OCR service failed")
|
Msg("request veDEM OCR service failed")
|
||||||
|
return nil, errors.New(imageResponse.Message)
|
||||||
}
|
}
|
||||||
|
|
||||||
imageResult = &imageResponse.Result
|
imageResult = &imageResponse.Result
|
||||||
|
|||||||
Reference in New Issue
Block a user