chore: apply new logger to order actions
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
package orderStatusActions
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"git.ma-al.com/goc_daniel/b2b/app/model"
|
||||
"git.ma-al.com/goc_daniel/b2b/app/model/enums"
|
||||
"git.ma-al.com/goc_daniel/b2b/app/service/emailService"
|
||||
"git.ma-al.com/goc_daniel/b2b/app/utils/logger"
|
||||
)
|
||||
|
||||
var GlobalRegistry = make(ActionRegistry)
|
||||
@@ -13,7 +12,6 @@ var GlobalRegistry = make(ActionRegistry)
|
||||
type ActionID string
|
||||
|
||||
type ActionContext struct {
|
||||
OrderId uint
|
||||
Order *model.CustomerOrder
|
||||
UserId *uint
|
||||
EmailService *emailService.EmailService
|
||||
@@ -37,7 +35,12 @@ func (c ActionChain) Execute(actionCtx ActionContext) []ActionResult {
|
||||
result := action.Execute(actionCtx)
|
||||
results = append(results, result)
|
||||
if result.Err != nil {
|
||||
log.Printf("action %s failed for order %d: %v", action.ID(), actionCtx.OrderId, result.Err)
|
||||
logger.Debug("action failed",
|
||||
"action_id", action.ID(),
|
||||
"order", actionCtx.Order,
|
||||
"user_id", actionCtx.UserId,
|
||||
"error", result.Err,
|
||||
)
|
||||
}
|
||||
}
|
||||
return results
|
||||
|
||||
Reference in New Issue
Block a user