mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 02:21:29 +08:00
refactor: log uixt action
This commit is contained in:
@@ -1 +1 @@
|
||||
v5.0.0+2412081242
|
||||
v5.0.0+2412081353
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user